Method and apparatus for prediction refinement with optical flow for an affine coded block

ABSTRACT

The present disclosure relates to an apparatus, an encoder, a decoder and corresponding methods for prediction refinement with optical flow (PROF) for an affine coded block, in which when a plurality of optical flow decision conditions are fulfilled for the affine coded block, performing a PROF process for a current sub-block of the affine coded block to obtain refined prediction sample values of the current sub-block of the affine coded block. After the sub-block based affine motion compensation is performed, a prediction sample value of the current sample of the current sub-block is refined by adding a delta prediction value. Thus, it allows for a better trade-off between coding complexity and prediction accuracy.

CROSS-REFERENCE TO RELATED APPLICATIONS

This patent application is a continuation of International ApplicationNo. PCT/CN2020/080412, filed on Mar. 20, 2020, which claims the priorityto U.S. Provisional Patent Application No. 62/821,440, filed Mar. 20,2019, and the priority to U.S. Provisional Patent Application No.62/839,765, filed Apr. 28, 2019. All of the aforementioned patentapplications are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

Embodiments of the present disclosure generally relate to the field ofpicture processing and more particularly to a method to refine thesub-block based affine motion compensated prediction with optical flowwhen one or more constraints are required.

BACKGROUND

Video coding (video encoding and decoding) is used in a wide range ofdigital video applications, for example broadcast digital TV, videotransmission over internet and mobile networks, real-time conversationalapplications such as video chat, video conferencing, DVD and Blu-raydiscs, video content acquisition and editing systems, and camcorders ofsecurity applications.

The amount of video data needed to depict even a relatively short videocan be substantial, which may result in difficulties when the data is tobe streamed or otherwise communicated across a communications networkwith limited bandwidth capacity. Thus, video data is generallycompressed before being communicated across modern daytelecommunications networks. The size of a video could also be an issuewhen the video is stored on a storage device because memory resourcesmay be limited. Video compression devices often use software and/orhardware at the source to code the video data prior to transmission orstorage, thereby decreasing the quantity of data needed to representdigital video images. The compressed data is then received at thedestination by a video decompression device that decodes the video data.With limited network resources and ever increasing demands of highervideo quality, improved compression and decompression techniques thatimprove compression ratio with little to no sacrifice in picture qualityare desirable.

Recently, an affine tool is introduced into Versatile Video Coding,theoretically affine motion model parameters can be used to derive themotion vector of each sample in a coding block. However, due to the highcomplexity for generating sample-based affine motion compensatedprediction, a sub-block based affine motion compensation method is used.In this method, the coding block is divided into sub-blocks, each ofwhich is assigned with a motion vector (MV) derived from the affinemotion model parameters. However, it loses prediction accuracy due tosub-block based prediction. Thus, a good trade-off between codingcomplexity and prediction accuracy needs to be achieved.

SUMMARY

Embodiments of the present application provide apparatuses and methodsfor encoding and decoding according to the independent claims.Embodiments of the present application provide apparatuses and methodsfor prediction refinement with optical flow (PROF) for an affine codedblock, so that a good trade-off between the complexity and sub-blockbased affine prediction accuracy may be achieved.

Embodiments are defined by the features of the independent claims, andfurther advantageous implementations of the embodiments by the featuresof the dependent claims.

Particular embodiments are outlined in the attached independent claims,with other embodiments in the dependent claims.

The foregoing and other objects are achieved by the subject matter ofthe independent claims. Further implementation forms are apparent fromthe dependent claims, the description and the figures.

According to a first aspect, the disclosure relates to a method forprediction refinement with optical flow (PROF) for an affine coded block(i.e., a block encoded or decoded using an affine tool) is provided. Themethod is applied to a sub-block of samples within the affine codedblock. The method is performed by encoding or decoding apparatus. Themethod may include:

performing a PROF process for a current sub-block of the affine codedblock to obtain refined prediction sample values (namely, finalprediction sample values) of the current sub-block (such as eachsubblock) of the affine coded block, wherein a plurality of constraintconditions for applying PROF are not fulfilled or satisfied for theaffine coded block;wherein the performing a PROF process for a current sub-block of theaffine coded block comprises: performing an optical flow processing forthe current sub-block to obtain a delta prediction value of a currentsample of the current sub-block; and obtaining a refined predictionsample value of the current sample based on the delta prediction valueof the current sample and a prediction sample value of the currentsample of the current sub-block(performing an optical flow processingfor the current sub-block to obtain delta prediction values of thecurrent sub-block; and obtaining the refined prediction sample values ofthe current sub-block based on the delta prediction values of thecurrent sub-block and prediction sample values of the currentsub-block). It can be understood that when the refined prediction samplevalues of each sub-block of the affine coded block are generated, therefined prediction sample values of the affine coded block are naturallygenerated.

Thus, an improved method is provided allowing for a better trade-offbetween coding complexity and prediction accuracy to be achieved. Theprediction refinement with optical flow (PROF) process is conditionallyperformed to refine the sub-block based affine motion compensatedprediction with optical flow in pixel/sample level granularity. Theseconditions ensure that the computations involved in the PROF only occurwhen prediction accuracy can be improved, thereby reducing unnecessarycomputation complexity increase. Therefore, the beneficial effectsachieved by the technology disclosed herein improve the overallcompression performance of the coding method.

It is noted that the term “block”, “coding block” or “image block” usedin the present disclosure can include transform units (TUs), predictionunits (PUs), coding units (CUs), etc. In VVC, transform units and codingunits are mostly aligned except in a few scenarios when TU tiling or subblock transform (SBT) is used. It can be understood that the terms“block”, “image block”, “coding block” and “picture block”. The terms“affine block”, “affine picture block”, “affine coded block” and “affinemotion block” may be used interchangeably herein. The terms “sample” and“pixel” may be used interchangeably with each other in the presentdisclosure. The terms “prediction sample value” and “prediction pixelvalues” may be used interchangeably with each other in the presentdisclosure. The terms “sample location” and “pixel location” may be usedinterchangeably with each other in the present disclosure.

In a possible implementation form of the method according to the firstaspect as such, before the performing a PROF process for a currentsub-block of the affine coded block, the method further comprises:determining that the plurality of constraint conditions for applyingPROF are not fulfilled for the affine coded block.

In a possible implementation form of the method according to the firstaspect as such, the plurality of constraint conditions for applying PROFcomprises: first indication information indicates that PROF is disabledfor a picture containing the affine coded block or first indicationinformation indicates that PROF is disabled for slices associated with apicture containing the affine coded block; and second indicationinformation indicates no partition of the affine coded block, i.e. thevariable fallbackModeTriggered is set to 1. It can be understood thatwhen the variable fallbackModeTriggered is set to 1, no partition of theaffine coded block is required, that is, each sub-block of the affinecoded block has the same motion vector. This indicates that the affinecoded block only has translational motion. When the variablefallbackModeTriggered is set to 0, partition of the affine coded blockis required, that is, each sub-block of the affine coded block has arespective motion vector. This indicates that the affine coded block hasnon-translational motion.

In the present disclosure, it is allowed that PROF is not applied insome cases or situations for the affine coded block. Those cases orsituations are determined according to the constraints for applying thePROF. In this way, a better trade-off between coding complexity andprediction accuracy can be achieved.

In a possible implementation form of the method according to anypreceding implementation of the first aspect or the first aspect assuch, the performing an optical flow processing for the currentsub-block to obtain a delta prediction value of a current sample of thecurrent sub-block comprises:

obtaining a second prediction matrix, (In an example, the secondprediction matrix is generated based on a first prediction matrix whichcorresponds to prediction sample values of the current sub-block. Here,the prediction sample values of the current sub-block may be obtained byperforming subblock-based affine motion compensation for the currentsub-block.) wherein a size of the second prediction matrix is greaterthan the size of the first prediction matrix (for example, the firstprediction matrix has the size of sbWidth*sbHeight and the secondprediction matrix has the size of (sbWidth+2)*(sbHeight+2) and thevariables sbWidth and sbHeight represent the width and the height of thecurrent subblock, respectively.); That is, the obtaining a secondprediction matrix comprises: generating a first prediction matrix basedon motion information of the current sub-block, wherein elements of thefirst prediction matrix correspond to prediction sample values of thecurrent sub-block, and generating the second prediction matrix based onthe first prediction matrix; or generating the second prediction matrixbased on the motion information of the current sub-block;

generating a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on the second prediction matrix,wherein a size of the second prediction matrix is greater than or equalto sizes of the horizontal prediction gradient matrix and the verticalprediction gradient matrix; (for example, the horizontal predictiongradient matrix or the vertical prediction gradient matrix has the sizeof sbWidth*sbHeight and the second prediction matrix has the size of(sbWidth+2)*(sbHeight+2)); andcalculating a delta prediction value (ΔI(i, j)) of a current sample ofthe current sub-block based on a horizontal prediction gradient value ofthe current sample in the horizontal prediction gradient matrix, avertical prediction gradient value of the current sample in the verticalprediction gradient matrix, and a difference (MVD) between a motionvector of the current sample of the current sub-block and a motionvector of a center sample of the sub-block. It can be understood thatthe MVD has a horizontal component and a vertical component. Thehorizontal prediction gradient value of the current sample in thehorizontal prediction gradient matrix corresponds to the horizontalcomponent of the MVD, and the vertical prediction gradient value of thecurrent sample in the vertical prediction gradient matrix corresponds tovertical component of the MVD.

It is noted that the affine block can be a coding block or a decodingblock of a picture of the video signal. The current sub-block of theaffine coded block is, for example, a 4×4 block. The luma location (xCb,yCb) denotes that location of the top-left sample of the affine codedblock relative to the top-left sample of the current picture. Samples ofthe current sub-block can be referred to using absolute positions of thesamples with respect to (or relative to) the top-left sample of thepicture, e.g., (x, y), or relative positions of the samples with respectto the top-left sample of the sub-block (in combination with othercoordinates), e.g., (xSb+i, ySb+j). Here, (xSb, ySb) is the coordinateof the upper left sample of the sub-block with respect to the upper leftsample of the picture.

The first prediction matrix can be a two-dimensional array that includerows and columns and an element of the array can be referred to using(i, j) where i is a horizontal/row index and j is a vertical/columnindex. The range of i and j can be, for example, i=0 . . . sbWidth−1 andj=0 . . . sbHeight−1. Here, sbWidth indicates the width of the subblock,and sbHeight indicates the height of the subblock. In some examples, thesize of the first prediction matrix is the same as the size of thecurrent block. For example, the size of the first prediction matrix canbe 4×4, and the current block has a size of 4×4.

The second prediction matrix can be a two-dimensional array that includerows and columns and an element of the array can be referred to using(i, j) where i is a horizontal/row index and j is a vertical/columnindex. The range of i and j can be, for example, i=−1 . . . sbWidth andj=−1 . . . sbHeight. Here, sbWidth indicates the width of the subblock,and sbHeight indicates the height of the subblock. In some examples, thesize of the second prediction matrix is larger than the size of thefirst prediction matrix. That is, the size of the second predictionmatrix can be larger than the size of the current block. For example,the size of the second prediction matrix can be(sbWidth+2)*(sbHeight+2), whereas the current block has a size ofsbWidth*sbHeight. For example, the size of the second prediction matrixcan be 6×6, whereas the current block has a size of 4×4.

The horizontal and vertical prediction gradient matrices can be anytwo-dimensional array that include rows and columns and an element ofthe array can be referred to using (i, j) where x is a horizontal/rowindex and y is a vertical/column index. The range of i and j can be, forexample, i=0 . . . sbWidth-1 and j=0 . . . sbHeight-1. sbWidth indicatesthe width of the subblock, and sbHeight indicates the height of thesubblock. In some examples, the size of the horizontal and verticalprediction gradient matrices is the same as the size of the currentblock. For example, the size of the horizontal and vertical predictiongradient matrices can be 4×4, and the current block has a size of 4×4.

An element of the horizontal prediction gradient matrix corresponds toan element of the vertical prediction gradient matrix if the element'sposition in the horizontal prediction gradient matrix, (x, y) is thesame as the element's position in the vertical prediction gradientmatrix (p, q), i.e., (x, y)=(p, q).

Thus, a PROF process is allowed to refine the sub-block based affinemotion compensated prediction with optical flow with the sample levelgranularity without increasing the memory access bandwidth (due to thesecond prediction matrix is based on the first prediction matrix or the(original) prediction sample values of the current sub-block) therebyachieving a finer granularity of motion compensation.

In a possible implementation form of the method according to anypreceding implementation of the first aspect or the first aspect assuch, a motion vector difference between a motion vector of a currentsample unit (for example, a 2×2 sample block) containing the currentsample and a motion vector of a center sample of the sub-block is usedas the difference between the motion vector of the current sample of thecurrent sub-block and the motion vector of the center sample of thesub-block. Here, the motion vector of a center sample of the sub-blockcan be understood as the MV of the subblock (i.e. the subblock MV) towhich the current sample (i,j) belongs. By using the sample unit, suchas the 2×2 sample block, to calculate the motion vector difference, itis allowed to balance processing overheads and prediction accuracy. In apossible implementation form of the method according to any precedingimplementation of the first aspect or the first aspect as such, anelement of the second prediction matrix is represented by I₁(p, q),wherein a value range of p is [−1, sbW], and a value range of q is [−1,sbH];

an element of the horizontal prediction gradient matrix is representedby X (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; and

an element of the vertical prediction gradient matrix is represented byY (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; wherein

sbW represents a width of the current sub-block in the affine codedblock, sbH represents a height of the current sub-block in the affinecoded block.

In another representation manner, an element of the second predictionmatrix is represented by I₁(p, q), wherein a value range of p is [0,subW+1], and a value range of q is [0, subH+1];

an element of the horizontal prediction gradient matrix is representedby X (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [1, sbW], and avalue range of j is [1, sbH]; and

an element of the vertical prediction gradient matrix is represented byY (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [1, sbW], and avalue range of j is [1, sbH]; wherein

sbW represents a width of the current sub-block in the affine codedblock, sbH represents a height of the current sub-block in the affinecoded block.

It can be understood that the top-left sample (or the origin ofcoordinate) is located at (1, 1) for p has a value from [0, subW+1] andq has a value from [0, subH+1]; while, the top-left sample(or the originof coordinate) is located at (0, 0) for p has a value from [−1, subW]and q has a value from [−1, subH].

In a possible implementation form of the method according to anypreceding implementation of the first aspect or the first aspect assuch, before the performing a PROF process for a current sub-block ofthe affine coded block, the method further comprises: performingsubblock-based affine motion compensation for the current sub-block ofthe affine coded block to obtain (original or to-be-refined) predictionsample values of the current sub-block.

According to a second aspect of the disclosure, a method for predictionrefinement with optical flow (PROF) for an affine coded block isprovided, the method comprising: performing a PROF process for a currentsub-block of the affine coded block to obtain refined prediction samplevalues (namely, final prediction sample values) of the current sub-blockof the affine coded block, wherein a plurality of optical flow decisionconditions are fulfilled for the affine coded block; Here, the pluralityof optical flow decision conditions are fulfilled, means that allconstraints for applying PROF are not fulfilled;

wherein the performing a PROF process for a current sub-block of theaffine coded block comprises: performing an optical flow processing forthe current sub-block to obtain a delta prediction value of a currentsample of the current sub-block; and obtaining a refined predictionsample value of the current sample based on the delta prediction valueof the current sample and a (original or to-be-refined) predictionsample value of the current sample of the current sub-block.

Thus, an improved method is provided allowing for a better trade-offbetween coding complexity and prediction accuracy to be achieved. Theprediction refinement with optical flow (PROF) process is conditionallyperformed to refine the sub-block based affine motion compensatedprediction with optical flow in pixel/sample level granularity. Theseconditions ensure that the computations involved in the PROF only occurwhen prediction accuracy can be improved, thereby reducing unnecessarycomputation complexity increase. Therefore, the beneficial effectsachieved by the technology disclosed herein improve the overallcompression performance of the coding method.

In a possible implementation form of the method according to the secondaspect as such, before the performing a PROF process for a currentsub-block of the affine coded block, the method further comprises:determining that the plurality of optical flow decision conditions arefulfilled for the affine coded block.

In a possible implementation form of the method according to the secondaspect as such, the plurality of optical flow decision conditionscomprises: first indication information indicates that PROF is enabledfor a picture containing the affine coded block or first indicationinformation indicates that PROF is enabled for slices associated with apicture containing the affine coded block; and second indicationinformation indicates partition of the affine coded block, such as thevariable fallbackModeTriggered is set equal to 0. It can be understoodthat when the variable fallbackModeTriggered is set equal to 0,partition of the affine coded block is required, that is, each subblockof the affine coded block has a respective Motion vector, whichindicates the affine coded block has un-translational motion.

It is allowed that PROF can be applied when all constraints for applyingPROF are not fulfilled according to the design of the constraints forapplying PROF. Thus, it allows for a trade-off between coding complexityand prediction accuracy.

In a possible implementation form of the method according to anypreceding implementation of the second aspect or the second aspect assuch, the performing an optical flow processing for the currentsub-block to obtain a delta prediction value of a current sample of thecurrent sub-block comprises:

obtaining a second prediction matrix, wherein the elements of the secondprediction matrix are based on prediction sample values of the currentsub-block; in some examples, the obtaining a second prediction matrix,comprises: generating a first prediction matrix based on motioninformation of the current sub-block, wherein elements of the firstprediction matrix correspond to prediction sample values of the currentsub-block, and generating the second prediction matrix based on thefirst prediction matrix; or generating the second prediction matrixbased on the motion information of the current sub-block;

generating a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on the second prediction matrix,wherein a size of the second prediction matrix is greater than or equalto sizes of the horizontal prediction gradient matrix and the verticalprediction gradient matrix; andcalculating a delta prediction value (ΔI(i, j)) of a current sample ofthe current sub-block based on a horizontal prediction gradient value ofthe current sample in the horizontal prediction gradient matrix, avertical prediction gradient value of the current sample in the verticalprediction gradient matrix, and a difference between a motion vector ofthe current sample of the current sub-block and a motion vector of acenter sample of the sub-block.

In a possible implementation form of the method according to anypreceding implementation of the second aspect or the second aspect assuch, further comprising: performing subblock-based affine motioncompensation for the current sub-block of the affine coded block, toobtain the (original) prediction sample values of the current sub-blockof the affine coded block.

In a possible implementation form of the method according to anypreceding implementation of the second aspect or the second aspect assuch, a motion vector difference between a motion vector of a currentsample unit (for example, a 2×2 sample block) to which the currentsample belong and a motion vector of a center sample of the sub-block isused as the difference between the motion vector of the current sampleof the current sub-block and the motion vector of the center sample ofthe sub-block.

In a possible implementation form of the method according to anypreceding implementation of the second aspect or the second aspect assuch,

an element of the second prediction matrix is represented by I₁(p, q),wherein a value range of p is [−1, sbW], and a value range of q is [−1,sbH];an element of the horizontal prediction gradient matrix is representedby X (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; andan element of the vertical prediction gradient matrix is represented byY (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; whereinsbW represents a width of the current sub-block in the affine codedblock, sbH represents a height of the current sub-block in the affinecoded block.

According to a third aspect, the disclosure relates to an apparatus forprediction refinement with optical flow (PROF) for an affine coded block(i.e., a block encoded or decoded using an affine tool) is provided. Theapparatus corresponds to an encoding or decoding apparatus. Theapparatus may include:

a determining unit configured for determining that the plurality ofconstraint conditions for applying PROF are not fulfilled for the affinecoded block.a prediction processing unit configured for performing a PROF processfor a current sub-block of the affine coded block to obtain refinedprediction sample values (namely, final prediction sample values) of thecurrent sub-block (such as each subblock) of the affine coded block,wherein a plurality of constraint conditions for applying PROF are notfulfilled or satisfied for the affine coded block;wherein the prediction processing unit is configured for performing anoptical flow processing for the current sub-block to obtain a deltaprediction value of a current sample of the current sub-block; andobtaining a refined prediction sample value of the current sample basedon the delta prediction value of the current sample and a predictionsample value of the current sample of the current sub-block(performingan optical flow processing for the current sub-block to obtain deltaprediction values of the current sub-block; and obtaining the refinedprediction sample values of the current sub-block based on the deltaprediction values of the current sub-block and prediction sample valuesof the current sub-block). It can be understood that when the refinedprediction sample values of each sub-block of the affine coded block aregenerated, the refined prediction sample values of the affine codedblock are naturally generated.

In a possible implementation form of the apparatus according to thethird aspect as such, the plurality of constraint conditions forapplying PROF comprises: first indication information indicates thatPROF is disabled for a picture containing the affine coded block orfirst indication information indicates that PROF is disabled for slicesassociated with a picture containing the affine coded block; and secondindication information indicates no partition of the affine coded block,i.e. the variable fallbackModeTriggered is set to 1. It can beunderstood that when the variable fallbackModeTriggered is set to 1, nopartition of the affine coded block is required, that is, each subblockof the affine coded block has the same motion vector. This indicatesthat the affine coded block only has translational motion. When thevariable fallbackModeTriggered is set to 0, partition of the affinecoded block is required, that is, each subblock of the affine codedblock has a respective motion vector. This indicates that the affinecoded block has non-translational motion.

In a possible implementation form of the apparatus according to anypreceding implementation of the third aspect or the third aspect assuch, the prediction processing unit is configured for obtaining asecond prediction matrix, (In an example, the second prediction matrixis generated based on a first prediction matrix which corresponds toprediction sample values of the current sub-block. Here, the predictionsample values of the current sub-block may be obtained by performingsubblock-based affine motion compensation for the current sub-block.)wherein a size of the second prediction matrix is greater than the sizeof the first prediction matrix (for example, the first prediction matrixhas the size of sbWidth*sbHeight and the second prediction matrix hasthe size of (sbWidth+2)*(sbHeight+2) and the variables sbWidth andsbHeight represent the width and the height of the current subblock,respectively.); That is, the obtaining a second prediction matrixcomprises: generating a first prediction matrix based on motioninformation of the current sub-block, wherein elements of the firstprediction matrix correspond to prediction sample values of the currentsub-block, and generating the second prediction matrix based on thefirst prediction matrix; or generating the second prediction matrixbased on the motion information of the current sub-block;

generating a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on the second prediction matrix,wherein a size of the second prediction matrix is greater than or equalto sizes of the horizontal prediction gradient matrix and the verticalprediction gradient matrix; (for example, the horizontal predictiongradient matrix or the vertical prediction gradient matrix has the sizeof sbWidth*sbHeight and the second prediction matrix has the size of(sbWidth+2)*(sbHeight+2)); andcalculating a delta prediction value (ΔI(i, j)) of a current sample ofthe current sub-block based on a horizontal prediction gradient value ofthe current sample in the horizontal prediction gradient matrix, avertical prediction gradient value of the current sample in the verticalprediction gradient matrix, and a difference between a motion vector ofthe current sample of the current sub-block and a motion vector of acenter sample of the sub-block.

In a possible implementation form of the apparatus according to anypreceding implementation of the third aspect or the third aspect assuch, a motion vector difference between a motion vector of a currentsample unit (for example, a 2×2 sample block) containing the currentsample and a motion vector of a center sample of the sub-block is usedas the difference between the motion vector of the current sample of thecurrent sub-block and the motion vector of the center sample of thesub-block. Here, the motion vector of a center sample of the sub-blockcan be understood as the MV of the subblock (i.e. the subblock MV) towhich the current sample (i,j) belongs. By using the sample unit, suchas the 2×2 sample block, to calculate the motion vector difference, itis allowed to balance processing overheads and prediction accuracy. In apossible implementation form of the apparatus according to any precedingimplementation of the third aspect or the third aspect as such, anelement of the second prediction matrix is represented by I₁(p, q),wherein a value range of p is [−1, sbW], and a value range of q is [−1,sbH];

an element of the horizontal prediction gradient matrix is representedby X (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; and

an element of the vertical prediction gradient matrix is represented byY (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; wherein

sbW represents a width of the current sub-block in the affine codedblock, sbH represents a height of the current sub-block in the affinecoded block.

In a possible implementation form of the apparatus according to anypreceding implementation of the third aspect or the third aspect assuch, the prediction processing uint 1503 is configured for performingsubblock-based affine motion compensation for the current sub-block ofthe affine coded block to obtain (original or to-be-refined) predictionsample values of the current sub-block.

According to a fourth aspect of the disclosure, an apparatus forprediction refinement with optical flow (PROF) for an affine coded blockis provided, the apparatus may comprises:

a determining unit configured for determining that a plurality ofoptical flow decision conditions are fulfilled for the affine codedblock; Here, the plurality of optical flow decision conditions arefulfilled, means that all constraints for applying PROF are notfulfilled;a prediction processing unit configured for performing a PROF processfor a current sub-block of the affine coded block to obtain refinedprediction sample values (namely, final prediction sample values) of thecurrent sub-block of the affine coded block, wherein a plurality ofoptical flow decision conditions are fulfilled for the affine codedblock; wherein the prediction processing unit is configured forperforming an optical flow processing for the current sub-block toobtain a delta prediction value of a current sample of the currentsub-block; and obtaining a refined prediction sample value of thecurrent sample based on the delta prediction value of the current sampleand a (original or to-be-refined) prediction sample value of the currentsample of the current sub-block.

In a possible implementation form of the apparatus according to thefourth aspect as such, the plurality of optical flow decision conditionscomprises: first indication information indicates that PROF is enabledfor a picture containing the affine coded block or first indicationinformation indicates that PROF is enabled for slices associated with apicture containing the affine coded block; and second indicationinformation indicates partition of the affine coded block, such as thevariable fallbackModeTriggered is set equal to 0. It can be understoodthat when the variable fallbackModeTriggered is set equal to 0,partition of the affine coded block is required, that is, each subblockof the affine coded block has a respective Motion vector, whichindicates the affine coded block has un-translational motion.

In a possible implementation form of the apparatus according to anypreceding implementation of the fourth aspect or the fourth aspect assuch, the prediction processing unit is configured for:

obtaining a second prediction matrix, wherein the elements of the secondprediction matrix are based on prediction sample values of the currentsub-block; in some examples, the obtaining a second prediction matrix,comprises: generating a first prediction matrix based on motioninformation of the current sub-block, wherein elements of the firstprediction matrix correspond to prediction sample values of the currentsub-block, and generating the second prediction matrix based on thefirst prediction matrix; or generating the second prediction matrixbased on the motion information of the current sub-block;

generating a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on the second prediction matrix,wherein a size of the second prediction matrix is greater than or equalto sizes of the horizontal prediction gradient matrix and the verticalprediction gradient matrix; andcalculating a delta prediction value (ΔI(i, j)) of a current sample ofthe current sub-block based on a horizontal prediction gradient value ofthe current sample in the horizontal prediction gradient matrix, avertical prediction gradient value of the current sample in the verticalprediction gradient matrix, and a difference between a motion vector ofthe current sample of the current sub-block and a motion vector of acenter sample of the sub-block.

In a possible implementation form of the apparatus according to anypreceding implementation of the fourth aspect or the fourth aspect assuch, the prediction processing unit is configured for performingsubblock-based affine motion compensation for the current sub-block ofthe affine coded block, to obtain the (original) prediction samplevalues of the current sub-block of the affine coded block.

In a possible implementation form of the apparatus according to anypreceding implementation of the fourth aspect or the fourth aspect assuch, a motion vector difference between a motion vector of a currentsample unit (for example, a 2×2 sample block) to which the currentsample belong and a motion vector of a center sample of the sub-block isused as the difference between the motion vector of the current sampleof the current sub-block and the motion vector of the center sample ofthe sub-block.

In a possible implementation form of the apparatus according to anypreceding implementation of the fourth aspect or the fourth aspect assuch, an element of the second prediction matrix is represented byI_(i)(p, q), wherein a value range of p is [−1, sbW], and a value rangeof q is [−1, sbH];

an element of the horizontal prediction gradient matrix is representedby X (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; andan element of the vertical prediction gradient matrix is represented byY (i, j) and corresponds to sample (i, j) of the current sub-block inthe affine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1]; whereinsbW represents a width of the current sub-block in the affine codedblock, sbH represents a height of the current sub-block in the affinecoded block.

The method according to the first aspect of the disclosure can beperformed by the apparatus according to the third aspect of thedisclosure. Further features and implementation forms of the apparatusaccording to the third aspect of the disclosure correspond to thefeatures and implementation forms of the method according to the firstaspect of the disclosure.

The method according to the second aspect of the disclosure can beperformed by the apparatus according to the fourth aspect of thedisclosure. Further features and implementation forms of the apparatusaccording to the fourth aspect of the disclosure correspond to thefeatures and implementation forms of the method according to the secondaspect of the disclosure.

According to a fifth aspect the disclosure relates to an encoder (20)comprising processing circuitry for carrying out the method according tothe first or second aspect as such or the implementation form thereof.

According to a sixth aspect the disclosure relates to a decoder (30)comprising processing circuitry for carrying out the method according tothe first or second aspect as such or the implementation form thereof.

According to a seventh aspect the disclosure relates to a decoder. Thedecoder comprises:

one or more processors; and

a non-transitory computer-readable storage medium coupled to theprocessors and storing programming for execution by the processors,wherein the programming, when executed by the processors, configures thedecoder to carry out the method according to the first aspect as such orthe implementation form thereof.

According to an eighth aspect the disclosure relates to an encoder. Theencoder comprises:

one or more processors; and

a non-transitory computer-readable storage medium coupled to theprocessors and storing programming for execution by the processors,wherein the programming, when executed by the processors, configures theencoder to carry out the method according to the first aspect as such orthe implementation form thereof.

According to a ninth aspect the disclosure relates to an apparatus forencoding a video stream includes a processor and a memory. The memory isstoring instructions that cause the processor to perform the methodaccording to the second aspect.

According to a tenth aspect the disclosure relates to an apparatus fordecoding a video stream includes a processor and a memory. The memory isstoring instructions that cause the processor to perform the methodaccording to the first aspect.

According to an eleventh aspect, the disclosure relates to a computerprogram comprising program code for performing the method according tothe first or second aspect or any possible embodiment of the first orsecond aspect when executed on a computer.

According to a twelfth aspect, a computer-readable storage medium havingstored thereon instructions that when executed cause one or moreprocessors configured to code video data is proposed. The instructionscause the one or more processors to perform a method according to thefirst or second aspect or any possible embodiment of the first or secondaspect.

According to a further aspect, a video picture encoding method isprovided and comprises: determining indication information, wherein theindication information is used to indicate whether a to-be-encodedpicture block is to be encoded according to a target inter predictionmethod, wherein the target inter prediction method comprises the interprediction method according to the first or second aspect or anypossible embodiment of the first or second aspect; and encoding theindication information into a bitstream.

According to a further aspect, a video picture decoding method isprovided and comprises: parsing a bitstream, to obtain indicationinformation, wherein the indication information is used to indicatewhether a to-be-decoded picture block is to be processed according to atarget inter prediction method, wherein the target inter predictionmethod comprises the inter prediction method according to the first orsecond aspect or any possible embodiment of the first or second aspect;and processing the to-be-decoded picture block according to the targetinter prediction method when the indication information indicates thatprocessing is performed according to the target inter prediction method.

Details of one or more embodiments are set forth in the accompanyingdrawings and the description below. Other features, objects, andadvantages will be apparent from the description, drawings, and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

In the following embodiments of the disclosure are described in moredetail with reference to the attached figures and drawings, in which:

FIG. 1A is a block diagram showing an example of a video coding systemconfigured to implement embodiments of the disclosure;

FIG. 1B is a block diagram showing another example of a video codingsystem configured to implement embodiments of the disclosure;

FIG. 2 is a block diagram showing an example of a video encoderconfigured to implement embodiments of the disclosure;

FIG. 3 is a block diagram showing an example structure of a videodecoder configured to implement embodiments of the disclosure;

FIG. 4 is a block diagram illustrating an example of an encodingapparatus or a decoding apparatus;

FIG. 5 is a block diagram illustrating another example of an encodingapparatus or a decoding apparatus;

FIG. 6 is a diagram showing spatial and temporal candidate motioninformation of the current block;

FIG. 7 is a diagram showing a current affine coded block and aneighboring affine coded block in which A1 is located;

FIG. 8A is a diagram showing an example to describe the constructedcontrol point motion vector prediction method;

FIG. 8B is a diagram showing an example to describe the constructedcontrol point motion vector prediction method;

FIG. 9A is a flowchart showing a process of a decoding method accordingto an embodiment of this application;

FIG. 9B is a diagram showing a constructed control point motion vectorsprediction method;

FIG. 9C is a diagram showing samples or pixels of a current affine codedblock and showing motion vectors of the top-left control point and thetop-right control point;

FIG. 9D is a diagram illustrating a 6×6 prediction signal window forcalculating or generating a horizontal prediction gradient matrix and avertical prediction gradient matrix and a 4×4 subblock;

FIG. 9E is a diagram illustrating a 18×18 prediction signal window forcalculating or generating a horizontal prediction gradient matrix and avertical prediction gradient matrix and a 16×16 block;

FIG. 10 is a diagram showing the difference Δv(i, j) (red arrow) betweensample MV computed for sample location (i,j), denoted by v(i,j), and thesubblock MV (v_(SB)) of the subblock to which sample (i,j) belongs;

FIG. 11A is a diagram showing a method for prediction refinement withoptical flow (PROF) for an affine coded block according to an embodimentof the present disclosure;

FIG. 11B is a diagram showing another method for prediction refinementwith optical flow (PROF) for an affine coded block according to anotherembodiment of the present disclosure;

FIG. 12 is a diagram showing a PROF process according to an embodimentof the present disclosure;

FIG. 13 is a diagram showing a surrounding region and an inner region ofa (M+2)*(N+2) prediction block according to an embodiment of the presentdisclosure;

FIG. 14 is a diagram showing a surrounding area and an internal area ofa (M+2)*(N+2) prediction block according to another embodiment of thepresent disclosure;

FIG. 15 is a block diagram showing an example structure of an apparatusfor prediction refinement with optical flow (PROF) for an affine codedblock of a video signal according to some aspects of the presentdisclosure;

FIG. 16 is a block diagram showing an example structure of a contentsupply system which realizes a content delivery service; and

FIG. 17 is a block diagram showing a structure of an example of aterminal device.

In the following identical reference signs refer to identical or atleast functionally equivalent features if not explicitly specifiedotherwise.

DETAILED DESCRIPTION OF THE EMBODIMENTS

In the following description, reference is made to the accompanyingfigures, which form part of the disclosure, and which show, by way ofillustration, specific aspects of embodiments of the disclosure orspecific aspects in which embodiments of the present disclosure may beused. It is understood that embodiments of the disclosure may be used inother aspects and comprise structural or logical changes not depicted inthe figures. The following detailed description, therefore, is not to betaken in a limiting sense, and the scope of the present disclosure isdefined by the appended claims.

For instance, it is understood that a disclosure in connection with adescribed method may also hold true for a corresponding device or systemconfigured to perform the method and vice versa. For example, if one ora plurality of specific method steps are described, a correspondingdevice may include one or a plurality of units, e.g. functional units,to perform the described one or plurality of method steps (e.g. one unitperforming the one or plurality of steps, or a plurality of units eachperforming one or more of the plurality of steps), even if such one ormore units are not explicitly described or illustrated in the figures.On the other hand, for example, if a specific apparatus is describedbased on one or a plurality of units, e.g. functional units, acorresponding method may include one step to perform the functionalityof the one or plurality of units (e.g. one step performing thefunctionality of the one or plurality of units, or a plurality of stepseach performing the functionality of one or more of the plurality ofunits), even if such one or plurality of steps are not explicitlydescribed or illustrated in the figures. Further, it is understood thatthe features of the various exemplary embodiments and/or aspectsdescribed herein may be combined with each other, unless specificallynoted otherwise.

Video coding typically refers to the processing of a sequence ofpictures, which form the video or video sequence. Instead of the term“picture” the term “frame” or “image” may be used as synonyms in thefield of video coding. Video coding (or coding in general) comprises twoparts video encoding and video decoding. Video encoding is performed atthe source side, typically comprising processing (e.g. by compression)the original video pictures to reduce the amount of data required forrepresenting the video pictures (for more efficient storage and/ortransmission). Video decoding is performed at the destination side andtypically comprises the inverse processing compared to the encoder toreconstruct the video pictures. Embodiments referring to “coding” ofvideo pictures (or pictures in general) shall be understood to relate to“encoding” or “decoding” of video pictures or respective videosequences. The combination of the encoding part and the decoding part isalso referred to as CODEC (Coding and Decoding).

In case of lossless video coding, the original video pictures can bereconstructed, i.e. the reconstructed video pictures have the samequality as the original video pictures (assuming no transmission loss orother data loss during storage or transmission). In case of lossy videocoding, further compression, e.g. by quantization, is performed, toreduce the amount of data representing the video pictures, which cannotbe completely reconstructed at the decoder, i.e. the quality of thereconstructed video pictures is lower or worse compared to the qualityof the original video pictures.

Several video coding standards belong to the group of “lossy hybridvideo codecs” (i.e. combine spatial and temporal prediction in thesample domain and 2D transform coding for applying quantization in thetransform domain). Each picture of a video sequence is typicallypartitioned into a set of non-overlapping blocks and the coding istypically performed on a block level. In other words, at the encoder thevideo is typically processed, i.e. encoded, on a block (video block)level, e.g. by using spatial (intra picture) prediction and/or temporal(inter picture) prediction to generate a prediction block, subtractingthe prediction block from the current block (block currentlyprocessed/to be processed) to obtain a residual block, transforming theresidual block and quantizing the residual block in the transform domainto reduce the amount of data to be transmitted (compression), whereas atthe decoder the inverse processing compared to the encoder is applied tothe encoded or compressed block to reconstruct the current block forrepresentation. Furthermore, the encoder duplicates the decoderprocessing loop such that both will generate identical predictions (e.g.intra- and inter predictions) and/or re-constructions for processing,i.e. coding, the subsequent blocks.

In the following embodiments of a video coding system 10, a videoencoder 20 and a video decoder 30 are described based on FIGS. 1 to 3.

FIG. 1A is a schematic block diagram illustrating an example codingsystem 10, e.g. a video coding system 10 (or short coding system 10)that may utilize techniques of this present application. Video encoder20 (or short encoder 20) and video decoder 30 (or short decoder 30) ofvideo coding system 10 represent examples of devices that may beconfigured to perform techniques in accordance with various examplesdescribed in the present application.

As shown in FIG. 1A, the coding system 10 comprises a source device 12configured to provide encoded picture data 21 e.g. to a destinationdevice 14 for decoding the encoded picture data 21.

The source device 12 comprises an encoder 20, and may additionally, i.e.optionally, comprise a picture source 16, a pre-processor (orpre-processing unit) 18, e.g. a picture pre-processor 18, and acommunication interface or communication unit 22.

The picture source 16 may comprise or be any kind of picture capturingdevice, for example a camera for capturing a real-world picture, and/orany kind of a picture generating device, for example a computer-graphicsprocessor for generating a computer animated picture, or any kind ofother device for obtaining and/or providing a real-world picture, acomputer generated picture (e.g. a screen content, a virtual reality(VR) picture) and/or any combination thereof (e.g. an augmented reality(AR) picture). The picture source may be any kind of memory or storagestoring any of the aforementioned pictures.

In distinction to the pre-processor 18 and the processing performed bythe pre-processing unit 18, the picture or picture data 17 may also bereferred to as raw picture or raw picture data 17.

Pre-processor 18 is configured to receive the (raw) picture data 17 andto perform pre-processing on the picture data 17 to obtain apre-processed picture 19 or pre-processed picture data 19.Pre-processing performed by the pre-processor 18 may, e.g., comprisetrimming, color format conversion (e.g. from RGB to YCbCr), colorcorrection, or de-noising. It can be understood that the pre-processingunit 18 may be optional component.

The video encoder 20 is configured to receive the pre-processed picturedata 19 and provide encoded picture data 21 (further details will bedescribed below, e.g., based on FIG. 2).

Communication interface 22 of the source device 12 may be configured toreceive the encoded picture data 21 and to transmit the encoded picturedata 21 (or any further processed version thereof) over communicationchannel 13 to another device, e.g. the destination device 14 or anyother device, for storage or direct reconstruction.

The destination device 14 comprises a decoder 30 (e.g. a video decoder30), and may additionally, i.e. optionally, comprise a communicationinterface or communication unit 28, a post-processor 32 (orpost-processing unit 32) and a display device 34.

The communication interface 28 of the destination device 14 isconfigured receive the encoded picture data 21 (or any further processedversion thereof), e.g. directly from the source device 12 or from anyother source, e.g. a storage device, e.g. an encoded picture datastorage device, and provide the encoded picture data 21 to the decoder30.

The communication interface 22 and the communication interface 28 may beconfigured to transmit or receive the encoded picture data 21 or encodeddata 13 via a direct communication link between the source device 12 andthe destination device 14, e.g. a direct wired or wireless connection,or via any kind of network, e.g. a wired or wireless network or anycombination thereof, or any kind of private and public network, or anykind of combination thereof.

The communication interface 22 may be, e.g., configured to package theencoded picture data 21 into an appropriate format, e.g. packets, and/orprocess the encoded picture data using any kind of transmission encodingor processing for transmission over a communication link orcommunication network.

The communication interface 28, forming the counterpart of thecommunication interface 22, may be, e.g., configured to receive thetransmitted data and process the transmission data using any kind ofcorresponding transmission decoding or processing and/or de-packaging toobtain the encoded picture data 21.

Both, communication interface 22 and communication interface 28 may beconfigured as unidirectional communication interfaces as indicated bythe arrow for the communication channel 13 in FIG. 1A pointing from thesource device 12 to the destination device 14, or bi-directionalcommunication interfaces, and may be configured, e.g. to send andreceive messages, e.g. to set up a connection, to acknowledge andexchange any other information related to the communication link and/ordata transmission, e.g. encoded picture data transmission.

The decoder 30 is configured to receive the encoded picture data 21 andprovide decoded picture data 31 or a decoded picture 31 (further detailswill be described below, e.g., based on FIG. 3 or FIG. 5).

The post-processor 32 of destination device 14 is configured topost-process the decoded picture data 31 (also called reconstructedpicture data), e.g. the decoded picture 31, to obtain post-processedpicture data 33, e.g. a post-processed picture 33. The post-processingperformed by the post-processing unit 32 may comprise, e.g. color formatconversion (e.g. from YCbCr to RGB), color correction, trimming, orre-sampling, or any other processing, e.g. for preparing the decodedpicture data 31 for display, e.g. by display device 34.

The display device 34 of the destination device 14 is configured toreceive the post-processed picture data 33 for displaying the picture,e.g. to a user or viewer. The display device 34 may be or comprise anykind of display for representing the reconstructed picture, e.g. anintegrated or external display or monitor. The displays may, e.g.comprise liquid crystal displays (LCD), organic light emitting diodes(OLED) displays, plasma displays, projectors, micro LED displays, liquidcrystal on silicon (LCoS), digital light processor (DLP) or any kind ofother display.

Although FIG. 1A depicts the source device 12 and the destination device14 as separate devices, embodiments of devices may also comprise both orboth functionalities, the source device 12 or correspondingfunctionality and the destination device 14 or correspondingfunctionality. In such embodiments the source device 12 or correspondingfunctionality and the destination device 14 or correspondingfunctionality may be implemented using the same hardware and/or softwareor by separate hardware and/or software or any combination thereof.

As will be apparent for the skilled person based on the description, theexistence and (exact) split of functionalities of the different units orfunctionalities within the source device 12 and/or destination device 14as shown in FIG. 1A may vary depending on the actual device andapplication.

The encoder 20 (e.g. a video encoder 20) or the decoder 30 (e.g. a videodecoder 30) or both encoder 20 and decoder 30 may be implemented viaprocessing circuitry as shown in FIG. 1B, such as one or moremicroprocessors, digital signal processors (DSPs), application-specificintegrated circuits (ASICs), field-programmable gate arrays (FPGAs),discrete logic, hardware, video coding dedicated or any combinationsthereof. The encoder 20 may be implemented via processing circuitry 46to embody the various modules as discussed with respect to encoder 20 ofFIG. 2 and/or any other encoder system or subsystem described herein.The decoder 30 may be implemented via processing circuitry 46 to embodythe various modules as discussed with respect to decoder 30 of FIG. 3and/or any other decoder system or subsystem described herein. Theprocessing circuitry may be configured to perform the various operationsas discussed later. As shown in FIG. 5, if the techniques areimplemented partially in software, a device may store instructions forthe software in a suitable, non-transitory computer-readable storagemedium and may execute the instructions in hardware using one or moreprocessors to perform the techniques of this disclosure. Either of videoencoder 20 and video decoder 30 may be integrated as part of a combinedencoder/decoder (CODEC) in a single device, for example, as shown inFIG. 1B.

Source device 12 and destination device 14 may comprise any of a widerange of devices, including any kind of handheld or stationary devices,e.g. notebook or laptop computers, mobile phones, smart phones, tabletsor tablet computers, cameras, desktop computers, set-top boxes,televisions, display devices, digital media players, video gamingconsoles, video streaming devices (such as content services servers orcontent delivery servers), broadcast receiver device, broadcasttransmitter device, or the like and may use no or any kind of operatingsystem. In some cases, the source device 12 and the destination device14 may be equipped for wireless communication. Thus, the source device12 and the destination device 14 may be wireless communication devices.

In some cases, video coding system 10 illustrated in FIG. 1A is merelyan example and the techniques of the present application may apply tovideo coding settings (e.g., video encoding or video decoding) that donot necessarily include any data communication between the encoding anddecoding devices. In other examples, data is retrieved from a localmemory, streamed over a network, or the like. A video encoding devicemay encode and store data to memory, and/or a video decoding device mayretrieve and decode data from memory. In some examples, the encoding anddecoding is performed by devices that do not communicate with oneanother, but simply encode data to memory and/or retrieve and decodedata from memory.

For convenience of description, embodiments of the disclosure aredescribed herein, for example, by reference to High-Efficiency VideoCoding (HEVC) or to the reference software of Versatile Video coding(VVC), the next generation video coding standard developed by the JointCollaboration Team on Video Coding (JCT-VC) of ITU-T Video CodingExperts Group (VCEG) and ISO/IEC Motion Picture Experts Group (MPEG).One of ordinary skill in the art will understand that embodiments of thedisclosure are not limited to HEVC or VVC.

Encoder and Encoding Method

FIG. 2 shows a schematic block diagram of an example video encoder 20that is configured to implement the techniques of the presentapplication. In the example of FIG. 2, the video encoder 20 comprises aninput 201 (or input interface 201), a residual calculation unit 204, atransform processing unit 206, a quantization unit 208, an inversequantization unit 210, and inverse transform processing unit 212, areconstruction unit 214, a loop filter unit 220, a decoded picturebuffer (DPB) 230, a mode selection unit 260, an entropy encoding unit270 and an output 272 (or output interface 272). The mode selection unit260 may include an inter prediction unit 244, an intra prediction unit254 and a partitioning unit 262. Inter prediction unit 244 may include amotion estimation unit and a motion compensation unit (not shown). Avideo encoder 20 as shown in FIG. 2 may also be referred to as hybridvideo encoder or a video encoder according to a hybrid video codec.

The residual calculation unit 204, the transform processing unit 206,the quantization unit 208, the mode selection unit 260 may be referredto as forming a forward signal path of the encoder 20, whereas theinverse quantization unit 210, the inverse transform processing unit212, the reconstruction unit 214, the buffer 216, the loop filter 220,the decoded picture buffer (DPB) 230, the inter prediction unit 244 andthe intra-prediction unit 254 may be referred to as forming a backwardsignal path of the video encoder 20, wherein the backward signal path ofthe video encoder 20 corresponds to the signal path of the decoder (seevideo decoder 30 in FIG. 3). The inverse quantization unit 210, theinverse transform processing unit 212, the reconstruction unit 214, theloop filter 220, the decoded picture buffer (DPB) 230, the interprediction unit 244 and the intra-prediction unit 254 are also referredto forming the “built-in decoder” of video encoder 20.

Pictures & Picture Partitioning (Pictures & Blocks)

The encoder 20 may be configured to receive, e.g. via input 201, apicture 17 (or picture data 17), e.g. picture of a sequence of picturesforming a video or video sequence. The received picture or picture datamay also be a pre-processed picture 19 (or pre-processed picture data19). For sake of simplicity the following description refers to thepicture 17. The picture 17 may also be referred to as current picture orpicture to be coded (in particular in video coding to distinguish thecurrent picture from other pictures, e.g. previously encoded and/ordecoded pictures of the same video sequence, i.e. the video sequencewhich also comprises the current picture).

A (digital) picture is or can be regarded as a two-dimensional array ormatrix of samples with intensity values. A sample in the array may alsobe referred to as pixel (short form of picture element) or a pel. Thenumber of samples in horizontal and vertical direction (or axis) of thearray or picture define the size and/or resolution of the picture. Forrepresentation of color, typically three color components are employed,i.e. the picture may be represented or include three sample arrays. InRGB format or color space a picture comprises a corresponding red, greenand blue sample array. However, in video coding each pixel is typicallyrepresented in a luminance and chrominance format or color space, e.g.YCbCr, which comprises a luminance component indicated by Y (sometimesalso L is used instead) and two chrominance components indicated by Cband Cr. The luminance (or short luma) component Y represents thebrightness or grey level intensity (e.g. like in a grey-scale picture),while the two chrominance (or short chroma) components Cb and Crrepresent the chromaticity or color information components. Accordingly,a picture in YCbCr format comprises a luminance sample array ofluminance sample values (Y), and two chrominance sample arrays ofchrominance values (Cb and Cr). Pictures in RGB format may be convertedor transformed into YCbCr format and vice versa, the process is alsoknown as color transformation or conversion. If a picture is monochrome,the picture may comprise only a luminance sample array. Accordingly, apicture may be, for example, an array of luma samples in monochromeformat or an array of luma samples and two corresponding arrays ofchroma samples in 4:2:0, 4:2:2, and 4:4:4 colour format.

Embodiments of the video encoder 20 may comprise a picture partitioningunit (not depicted in FIG. 2) configured to partition the picture 17into a plurality of (typically non-overlapping) picture blocks 203.These blocks may also be referred to as root blocks, macro blocks(H.264/AVC) or coding tree blocks (CTB) or coding tree units (CTU)(H.265/HEVC and VVC). The picture partitioning unit may be configured touse the same block size for all pictures of a video sequence and thecorresponding grid defining the block size, or to change the block sizebetween pictures or subsets or groups of pictures, and partition eachpicture into the corresponding blocks.

In further embodiments, the video encoder may be configured to receivedirectly a block 203 of the picture 17, e.g. one, several or all blocksforming the picture 17. The picture block 203 may also be referred to ascurrent picture block or picture block to be coded.

Like the picture 17, the picture block 203 again is or can be regardedas a two-dimensional array or matrix of samples with intensity values(sample values), although of smaller dimension than the picture 17. Inother words, the block 203 may comprise, e.g., one sample array (e.g. aluma array in case of a monochrome picture 17, or a luma or chroma arrayin case of a color picture) or three sample arrays (e.g. a luma and twochroma arrays in case of a color picture 17) or any other number and/orkind of arrays depending on the color format applied. The number ofsamples in horizontal and vertical direction (or axis) of the block 203define the size of block 203. Accordingly, a block may, for example, anMxN (M-column by N-row) array of samples, or an M×N array of transformcoefficients.

Embodiments of the video encoder 20 as shown in FIG. 2 may be configuredto encode the picture 17 block by block, e.g. the encoding andprediction is performed per block 203.

Embodiments of the video encoder 20 as shown in FIG. 2 may be furtherconfigured to partition and/or encode the picture by using slices (alsoreferred to as video slices), wherein a picture may be partitioned intoor encoded using one or more slices (typically non-overlapping), andeach slice may comprise one or more blocks (e.g. CTUs).

Embodiments of the video encoder 20 as shown in FIG. 2 may be furtherconfigured to partition and/or encode the picture by using tile groups(also referred to as video tile groups) and/or tiles (also referred toas video tiles), wherein a picture may be partitioned into or encodedusing one or more tile groups (typically non-overlapping), and each tilegroup may comprise, e.g. one or more blocks (e.g. CTUs) or one or moretiles, wherein each tile, e.g. may be of rectangular shape and maycomprise one or more blocks (e.g. CTUs), e.g. complete or fractionalblocks.

Residual Calculation

The residual calculation unit 204 may be configured to calculate aresidual block 205 (also referred to as residual 205) based on thepicture block 203 and a prediction block 265 (further details about theprediction block 265 are provided later), e.g. by subtracting samplevalues of the prediction block 265 from sample values of the pictureblock 203, sample by sample (pixel by pixel) to obtain the residualblock 205 in the sample domain.

Transform

The transform processing unit 206 may be configured to apply atransform, e.g. a discrete cosine transform (DCT) or discrete sinetransform (DST), on the sample values of the residual block 205 toobtain transform coefficients 207 in a transform domain. The transformcoefficients 207 may also be referred to as transform residualcoefficients and represent the residual block 205 in the transformdomain.

The transform processing unit 206 may be configured to apply integerapproximations of DCT/DST, such as the transforms specified forH.265/HEVC. Compared to an orthogonal DCT transform, such integerapproximations are typically scaled by a certain factor. In order topreserve the norm of the residual block which is processed by forwardand inverse transforms, additional scaling factors are applied as partof the transform process. The scaling factors are typically chosen basedon certain constraints like scaling factors being a power of two forshift operations, bit depth of the transform coefficients, tradeoffbetween accuracy and implementation costs, etc. Specific scaling factorsare, for example, specified for the inverse transform, e.g. by inversetransform processing unit 212 (and the corresponding inverse transform,e.g. by inverse transform processing unit 312 at video decoder 30) andcorresponding scaling factors for the forward transform, e.g. bytransform processing unit 206, at an encoder 20 may be specifiedaccordingly.

Embodiments of the video encoder 20 (respectively transform processingunit 206) may be configured to output transform parameters, e.g. a typeof transform or transforms, e.g. directly or encoded or compressed viathe entropy encoding unit 270, so that, e.g., the video decoder 30 mayreceive and use the transform parameters for decoding.

Quantization

The quantization unit 208 may be configured to quantize the transformcoefficients 207 to obtain quantized coefficients 209, e.g. by applyingscalar quantization or vector quantization. The quantized coefficients209 may also be referred to as quantized transform coefficients 209 orquantized residual coefficients 209.

The quantization process may reduce the bit depth associated with someor all of the transform coefficients 207. For example, an n-bittransform coefficient may be rounded down to an m-bit Transformcoefficient during quantization, where n is greater than m. The degreeof quantization may be modified by adjusting a quantization parameter(QP). For example for scalar quantization, different scaling may beapplied to achieve finer or coarser quantization. Smaller quantizationstep sizes correspond to finer quantization, whereas larger quantizationstep sizes correspond to coarser quantization. The applicablequantization step size may be indicated by a quantization parameter(QP). The quantization parameter may for example be an index to apredefined set of applicable quantization step sizes. For example, smallquantization parameters may correspond to fine quantization (smallquantization step sizes) and large quantization parameters maycorrespond to coarse quantization (large quantization step sizes) orvice versa. The quantization may include division by a quantization stepsize and a corresponding and/or the inverse dequantization, e.g. byinverse quantization unit 210, may include multiplication by thequantization step size. Embodiments according to some standards, e.g.HEVC, may be configured to use a quantization parameter to determine thequantization step size. Generally, the quantization step size may becalculated based on a quantization parameter using a fixed pointapproximation of an equation including division. Additional scalingfactors may be introduced for quantization and dequantization to restorethe norm of the residual block, which might get modified because of thescaling used in the fixed point approximation of the equation forquantization step size and quantization parameter. In one exampleimplementation, the scaling of the inverse transform and dequantizationmight be combined. Alternatively, customized quantization tables may beused and signaled from an encoder to a decoder, e.g. in a bitstream. Thequantization is a lossy operation, wherein the loss increases withincreasing quantization step sizes.

Embodiments of the video encoder 20 (respectively quantization unit 208)may be configured to output quantization parameters (QP), e.g. directlyor encoded via the entropy encoding unit 270, so that, e.g., the videodecoder 30 may receive and apply the quantization parameters fordecoding.

Inverse Quantization

The inverse quantization unit 210 is configured to apply the inversequantization of the quantization unit 208 on the quantized coefficientsto obtain dequantized coefficients 211, e.g. by applying the inverse ofthe quantization scheme applied by the quantization unit 208 based on orusing the same quantization step size as the quantization unit 208. Thedequantized coefficients 211 may also be referred to as dequantizedresidual coefficients 211 and correspond—although typically notidentical to the transform coefficients due to the loss byquantization—to the transform coefficients 207.

Inverse Transform

The inverse transform processing unit 212 is configured to apply theinverse transform of the transform applied by the transform processingunit 206, e.g. an inverse discrete cosine transform (DCT) or inversediscrete sine transform (DST) or other inverse transforms, to obtain areconstructed residual block 213 (or corresponding dequantizedcoefficients 213) in the sample domain. The reconstructed residual block213 may also be referred to as transform block 213.

Reconstruction

The reconstruction unit 214 (e.g. adder or summer 214) is configured toadd the transform block 213 (i.e. reconstructed residual block 213) tothe prediction block 265 to obtain a reconstructed block 215 in thesample domain, e.g. by adding—sample by sample—the sample values of thereconstructed residual block 213 and the sample values of the predictionblock 265.

Filtering

The loop filter unit 220 (or short “loop filter” 220), is configured tofilter the reconstructed block 215 to obtain a filtered block 221, or ingeneral, to filter reconstructed samples to obtain filtered samples. Theloop filter unit is, e.g., configured to smooth pixel transitions, orotherwise improve the video quality. The loop filter unit 220 maycomprise one or more loop filters such as a de-blocking filter, asample-adaptive offset (SAO) filter or one or more other filters, e.g. abilateral filter, an adaptive loop filter (ALF), a sharpening, asmoothing filters or a collaborative filters, or any combinationthereof. Although the loop filter unit 220 is shown in FIG. 2 as beingan in loop filter, in other configurations, the loop filter unit 220 maybe implemented as a post loop filter. The filtered block 221 may also bereferred to as filtered reconstructed block 221.

Embodiments of the video encoder 20 (respectively loop filter unit 220)may be configured to output loop filter parameters (such as sampleadaptive offset information), e.g. directly or encoded via the entropyencoding unit 270, so that, e.g., a decoder 30 may receive and apply thesame loop filter parameters or respective loop filters for decoding.

Decoded Picture Buffer

The decoded picture buffer (DPB) 230 may be a memory that storesreference pictures, or in general reference picture data, for encodingvideo data by video encoder 20. The DPB 230 may be formed by any of avariety of memory devices, such as dynamic random access memory (DRAM),including synchronous DRAM (SDRAM), magnetoresistive RAM (MRAM),resistive RAM (RRAM), or other types of memory devices. The decodedpicture buffer (DPB) 230 may be configured to store one or more filteredblocks 221. The decoded picture buffer 230 may be further configured tostore other previously filtered blocks, e.g. previously reconstructedand filtered blocks 221, of the same current picture or of differentpictures, e.g. previously reconstructed pictures, and may providecomplete previously reconstructed, i.e. decoded, pictures (andcorresponding reference blocks and samples) and/or a partiallyreconstructed current picture (and corresponding reference blocks andsamples), for example for inter prediction. The decoded picture buffer(DPB) 230 may be also configured to store one or more unfilteredreconstructed blocks 215, or in general unfiltered reconstructedsamples, e.g. if the reconstructed block 215 is not filtered by loopfilter unit 220, or any other further processed version of thereconstructed blocks or samples.

Mode Selection (Partitioning & Prediction)

The mode selection unit 260 comprises partitioning unit 262,inter-prediction unit 244 and intra-prediction unit 254, and isconfigured to receive or obtain original picture data, e.g. an originalblock 203 (current block 203 of the current picture 17), andreconstructed picture data, e.g. filtered and/or unfilteredreconstructed samples or blocks of the same (current) picture and/orfrom one or a plurality of previously decoded pictures, e.g. fromdecoded picture buffer 230 or other buffers (e.g. line buffer, notshown). The reconstructed picture data is used as reference picture datafor prediction, e.g. inter-prediction or intra-prediction, to obtain aprediction block 265 or predictor 265.

Mode selection unit 260 may be configured to determine or select apartitioning for a current block prediction mode (including nopartitioning) and a prediction mode (e.g. an intra or inter predictionmode) and generate a corresponding prediction block 265, which is usedfor the calculation of the residual block 205 and for the reconstructionof the reconstructed block 215.

Embodiments of the mode selection unit 260 may be configured to selectthe partitioning and the prediction mode (e.g. from those supported byor available for mode selection unit 260), which provide the best matchor in other words the minimum residual (minimum residual means bettercompression for transmission or storage), or a minimum signalingoverhead (minimum signaling overhead means better compression fortransmission or storage), or which considers or balances both. The modeselection unit 260 may be configured to determine the partitioning andprediction mode based on rate distortion optimization (RDO), i.e. selectthe prediction mode which provides a minimum rate distortion. Terms like“best”, “minimum”, “optimum” etc. in this context do not necessarilyrefer to an overall “best”, “minimum”, “optimum”, etc. but may alsorefer to the fulfillment of a termination or selection criterion like avalue exceeding or falling below a threshold or other constraintsleading potentially to a “sub-optimum selection” but reducing complexityand processing time.

In other words, the partitioning unit 262 may be configured to partitionthe block 203 into smaller block partitions or sub-blocks (which formagain blocks), e.g. iteratively using quad-tree-partitioning (QT),binary partitioning (BT) or triple-tree-partitioning (TT) or anycombination thereof, and to perform, e.g., the prediction for each ofthe block partitions or sub-blocks, wherein the mode selection comprisesthe selection of the tree-structure of the partitioned block 203 and theprediction modes are applied to each of the block partitions orsub-blocks.

In the following the partitioning (e.g. by partitioning unit 260) andprediction processing (by inter-prediction unit 244 and intra-predictionunit 254) performed by an example video encoder 20 will be explained inmore detail.

Partitioning

The partitioning unit 262 may partition (or split) a current block 203into smaller partitions, e.g. smaller blocks of square or rectangularsize. These smaller blocks (which may also be referred to as sub-blocks)may be further partitioned into even smaller partitions. This is alsoreferred to tree-partitioning or hierarchical tree-partitioning, whereina root block, e.g. at root tree-level 0 (hierarchy-level 0, depth 0),may be recursively partitioned, e.g. partitioned into two or more blocksof a next lower tree-level, e.g. nodes at tree-level 1 (hierarchy-level1, depth 1), wherein these blocks may be again partitioned into two ormore blocks of a next lower level, e.g. tree-level 2 (hierarchy-level 2,depth 2), etc. until the partitioning is terminated, e.g. because atermination criterion is fulfilled, e.g. a maximum tree depth or minimumblock size is reached. Blocks which are not further partitioned are alsoreferred to as leaf-blocks or leaf nodes of the tree. A tree usingpartitioning into two partitions is referred to as binary-tree (BT), atree using partitioning into three partitions is referred to asternary-tree (TT), and a tree using partitioning into four partitions isreferred to as quad-tree (QT).

As mentioned before, the term “block” as used herein may be a portion,in particular a square or rectangular portion, of a picture. Withreference, for example, to HEVC and VVC, the block may be or correspondto a coding tree unit (CTU), a coding unit (CU), prediction unit (PU),and transform unit (TU) and/or to the corresponding blocks, e.g. acoding tree block (CTB), a coding block (CB), a transform block (TB) orprediction block (PB).

For example, a coding tree unit (CTU) may be or comprise a CTB of lumasamples, two corresponding CTBs of chroma samples of a picture that hasthree sample arrays, or a CTB of samples of a monochrome picture or apicture that is coded using three separate colour planes and syntaxstructures used to code the samples. Correspondingly, a coding treeblock (CTB) may be an N×N block of samples for some value of N such thatthe division of a component into CTBs is a partitioning. A coding unit(CU) may be or comprise a coding block of luma samples, twocorresponding coding blocks of chroma samples of a picture that hasthree sample arrays, or a coding block of samples of a monochromepicture or a picture that is coded using three separate colour planesand syntax structures used to code the samples. Correspondingly a codingblock (CB) may be an M×N block of samples for some values of M and Nsuch that the division of a CTB into coding blocks is a partitioning.

In embodiments, e.g., according to HEVC, a coding tree unit (CTU) may besplit into CUs by using a quad-tree structure denoted as coding tree.The decision whether to code a picture area using inter-picture(temporal) or intra-picture (spatial) prediction is made at the CUlevel. Each CU can be further split into one, two or four PUs accordingto the PU splitting type. Inside one PU, the same prediction process isapplied and the relevant information is transmitted to the decoder on aPU basis. After obtaining the residual block by applying the predictionprocess based on the PU splitting type, a CU can be partitioned intotransform units (TUs) according to another quadtree structure similar tothe coding tree for the CU.

In embodiments, e.g., according to the latest video coding standardcurrently in development, which is referred to as Versatile Video Coding(VVC), a combined Quad-tree and binary tree (QTBT) partitioning is forexample used to partition a coding block. In the QTBT block structure, aCU can have either a square or rectangular shape. For example, a codingtree unit (CTU) is first partitioned by a quadtree structure. Thequadtree leaf nodes are further partitioned by a binary tree or ternary(or triple) tree structure. The partitioning tree leaf nodes are calledcoding units (CUs), and that segmentation is used for prediction andtransform processing without any further partitioning. This means thatthe CU, PU and TU have the same block size in the QTBT coding blockstructure. In parallel, multiple partition, for example, triple treepartition may be used together with the QTBT block structure.

In one example, the mode selection unit 260 of video encoder 20 may beconfigured to perform any combination of the partitioning techniquesdescribed herein.

As described above, the video encoder 20 is configured to determine orselect the best or an optimum prediction mode from a set of (e.g.pre-determined) prediction modes. The set of prediction modes maycomprise, e.g., intra-prediction modes and/or inter-prediction modes.

Intra-Prediction

The set of intra-prediction modes may comprise 35 differentintra-prediction modes, e.g. non-directional modes like DC (or mean)mode and planar mode, or directional modes, e.g. as defined in HEVC, ormay comprise 67 different intra-prediction modes, e.g. non-directionalmodes like DC (or mean) mode and planar mode, or directional modes, e.g.as defined for VVC.

The intra-prediction unit 254 is configured to use reconstructed samplesof neighboring blocks of the same current picture to generate anintra-prediction block 265 according to an intra-prediction mode of theset of intra-prediction modes.

The intra prediction unit 254 (or in general the mode selection unit260) is further configured to output intra-prediction parameters (or ingeneral information indicative of the selected intra prediction mode forthe block) to the entropy encoding unit 270 in form of syntax elements266 for inclusion into the encoded picture data 21, so that, e.g., thevideo decoder 30 may receive and use the prediction parameters fordecoding.

Inter-Prediction

The set of (or possible) inter-prediction modes depends on the availablereference pictures (i.e. previous at least partially decoded pictures,e.g. stored in DPB 230) and other inter-prediction parameters, e.g.whether the whole reference picture or only a part, e.g. a search windowarea around the area of the current block, of the reference picture isused for searching for a best matching reference block, and/or e.g.whether pixel interpolation is applied, e.g. half/semi-pel and/orquarter-pel interpolation, or not.

Additional to the above prediction modes, skip mode and/or direct modemay be applied.

The inter prediction unit 244 may include a motion estimation (ME) unitand a motion compensation (MC) unit (both not shown in FIG. 2). Themotion estimation unit may be configured to receive or obtain thepicture block 203 (current picture block 203 of the current picture 17)and a decoded picture 231, or at least one or a plurality of previouslyreconstructed blocks, e.g. reconstructed blocks of one or a plurality ofother/different previously decoded pictures 231, for motion estimation.E.g. a video sequence may comprise the current picture and thepreviously decoded pictures 231, or in other words, the current pictureand the previously decoded pictures 231 may be part of or form asequence of pictures forming a video sequence.

The encoder 20 may, e.g., be configured to select a reference block froma plurality of reference blocks of the same or different pictures of theplurality of other pictures and provide a reference picture (orreference picture index) and/or an offset (spatial offset) between theposition (x, y coordinates) of the reference block and the position ofthe current block as inter prediction parameters to the motionestimation unit. This offset is also called motion vector (MV).

The motion compensation unit is configured to obtain, e.g. receive, aninter prediction parameter and to perform inter prediction based on orusing the inter prediction parameter to obtain an inter prediction block265. Motion compensation, performed by the motion compensation unit, mayinvolve fetching or generating the prediction block based on themotion/block vector determined by motion estimation, possibly performinginterpolations to sub-sample precision. Interpolation filtering maygenerate additional samples from known samples, thus potentiallyincreasing the number of candidate prediction blocks that may be used tocode a picture block. Upon receiving the motion vector for the PU of thecurrent picture block, the motion compensation unit may locate theprediction block to which the motion vector points in one of thereference picture lists.

The motion compensation unit may also generate syntax elementsassociated with the blocks and video slices for use by video decoder 30in decoding the picture blocks of the video slice. In addition or as analternative to slices and respective syntax elements, tile groups and/ortiles and respective syntax elements may be generated or used.

Entropy Coding

The entropy encoding unit 270 is configured to apply, for example, anentropy encoding algorithm or scheme (e.g. a variable length coding(VLC) scheme, an context adaptive VLC scheme (CAVLC), an arithmeticcoding scheme, a binarization, a context adaptive binary arithmeticcoding (CABAC), syntax-based context-adaptive binary arithmetic coding(SBAC), probability interval partitioning entropy (PIPE) coding oranother entropy encoding methodology or technique) or bypass (nocompression) on the quantized coefficients 209, inter predictionparameters, intra prediction parameters, loop filter parameters and/orother syntax elements to obtain encoded picture data 21 which can beoutput via the output 272, e.g. in the form of an encoded bitstream 21,so that, e.g., the video decoder 30 may receive and use the parametersfor decoding. The encoded bitstream 21 may be transmitted to videodecoder 30, or stored in a memory for later transmission or retrieval byvideo decoder 30.

Other structural variations of the video encoder 20 can be used toencode the video stream. For example, a non-transform based encoder 20can quantize the residual signal directly without the transformprocessing unit 206 for certain blocks or frames. In anotherimplementation, an encoder 20 can have the quantization unit 208 and theinverse quantization unit 210 combined into a single unit.

Decoder and Decoding Method

FIG. 3 shows an example of a video decoder 30 that is configured toimplement the techniques of this present application. The video decoder30 is configured to receive encoded picture data 21 (e.g. encodedbitstream 21), e.g. encoded by encoder 20, to obtain a decoded picture331. The encoded picture data or bitstream comprises information fordecoding the encoded picture data, e.g. data that represents pictureblocks of an encoded video slice (and/or tile groups or tiles) andassociated syntax elements.

In the example of FIG. 3, the decoder 30 comprises an entropy decodingunit 304, an inverse quantization unit 310, an inverse transformprocessing unit 312, a reconstruction unit 314 (e.g. a summer 314), aloop filter 320, a decoded picture buffer (DPB) 330, a mode applicationunit 360, an inter prediction unit 344 and an intra prediction unit 354.Inter prediction unit 344 may be or include a motion compensation unit.Video decoder 30 may, in some examples, perform a decoding passgenerally reciprocal to the encoding pass described with respect tovideo encoder 100 from FIG. 2.

As explained with regard to the encoder 20, the inverse quantizationunit 210, the inverse transform processing unit 212, the reconstructionunit 214 the loop filter 220, the decoded picture buffer (DPB) 230, theinter prediction unit 344 and the intra prediction unit 354 are alsoreferred to as forming the “built-in decoder” of video encoder 20.Accordingly, the inverse quantization unit 310 may be identical infunction to the inverse quantization unit 110, the inverse transformprocessing unit 312 may be identical in function to the inversetransform processing unit 212, the reconstruction unit 314 may beidentical in function to reconstruction unit 214, the loop filter 320may be identical in function to the loop filter 220, and the decodedpicture buffer 330 may be identical in function to the decoded picturebuffer 230. Therefore, the explanations provided for the respectiveunits and functions of the video 20 encoder apply correspondingly to therespective units and functions of the video decoder 30.

Entropy Decoding

The entropy decoding unit 304 is configured to parse the bitstream 21(or in general encoded picture data 21) and perform, for example,entropy decoding to the encoded picture data 21 to obtain, e.g.,quantized coefficients 309 and/or decoded coding parameters (not shownin FIG. 3), e.g. any or all of inter prediction parameters (e.g.reference picture index and motion vector), intra prediction parameter(e.g. intra prediction mode or index), transform parameters,quantization parameters, loop filter parameters, and/or other syntaxelements. Entropy decoding unit 304 maybe configured to apply thedecoding algorithms or schemes corresponding to the encoding schemes asdescribed with regard to the entropy encoding unit 270 of the encoder20. Entropy decoding unit 304 may be further configured to provide interprediction parameters, intra prediction parameter and/or other syntaxelements to the mode application unit 360 and other parameters to otherunits of the decoder 30. Video decoder 30 may receive the syntaxelements at the video slice level and/or the video block level. Inaddition or as an alternative to slices and respective syntax elements,tile groups and/or tiles and respective syntax elements may be receivedand/or used.

Inverse Quantization

The inverse quantization unit 310 may be configured to receivequantization parameters (QP) (or in general information related to theinverse quantization) and quantized coefficients from the encodedpicture data 21 (e.g. by parsing and/or decoding, e.g. by entropydecoding unit 304) and to apply based on the quantization parameters aninverse quantization on the decoded quantized coefficients 309 to obtaindequantized coefficients 311, which may also be referred to as transformcoefficients 311. The inverse quantization process may include use of aquantization parameter determined by video encoder 20 for each videoblock in the video slice (or tile or tile group) to determine a degreeof quantization and, likewise, a degree of inverse quantization thatshould be applied.

Inverse Transform

Inverse transform processing unit 312 may be configured to receivedequantized coefficients 311, also referred to as transform coefficients311, and to apply a transform to the dequantized coefficients 311 inorder to obtain reconstructed residual blocks 213 in the sample domain.The reconstructed residual blocks 213 may also be referred to astransform blocks 313. The transform may be an inverse transform, e.g.,an inverse DCT, an inverse DST, an inverse integer transform, or aconceptually similar inverse transform process. The inverse transformprocessing unit 312 may be further configured to receive transformparameters or corresponding information from the encoded picture data 21(e.g. by parsing and/or decoding, e.g. by entropy decoding unit 304) todetermine the transform to be applied to the dequantized coefficients311.

Reconstruction

The reconstruction unit 314 (e.g. adder or summer 314) may be configuredto add the reconstructed residual block 313, to the prediction block 365to obtain a reconstructed block 315 in the sample domain, e.g. by addingthe sample values of the reconstructed residual block 313 and the samplevalues of the prediction block 365.

Filtering

The loop filter unit 320 (either in the coding loop or after the codingloop) is configured to filter the reconstructed block 315 to obtain afiltered block 321, e.g. to smooth pixel transitions, or otherwiseimprove the video quality. The loop filter unit 320 may comprise one ormore loop filters such as a de-blocking filter, a sample-adaptive offset(SAO) filter or one or more other filters, e.g. a bilateral filter, anadaptive loop filter (ALF), a sharpening, a smoothing filters or acollaborative filters, or any combination thereof. Although the loopfilter unit 320 is shown in FIG. 3 as being an in loop filter, in otherconfigurations, the loop filter unit 320 may be implemented as a postloop filter.

Decoded Picture Buffer

The decoded video blocks 321 of a picture are then stored in decodedpicture buffer 330, which stores the decoded pictures 331 as referencepictures for subsequent motion compensation for other pictures and/orfor output respectively display.

The decoder 30 is configured to output the decoded picture 311, e.g. viaoutput 312, for presentation or viewing to a user.

Prediction

The inter prediction unit 344 may be identical to the inter predictionunit 244 (in particular to the motion compensation unit) and the intraprediction unit 354 may be identical to the inter prediction unit 254 infunction, and performs split or partitioning decisions and predictionbased on the partitioning and/or prediction parameters or respectiveinformation received from the encoded picture data 21 (e.g. by parsingand/or decoding, e.g. by entropy decoding unit 304). Mode applicationunit 360 may be configured to perform the prediction (intra or interprediction) per block based on reconstructed pictures, blocks orrespective samples (filtered or unfiltered) to obtain the predictionblock 365.

When the video slice is coded as an intra coded (I) slice, intraprediction unit 354 of mode application unit 360 is configured togenerate prediction block 365 for a picture block of the current videoslice based on a signaled intra prediction mode and data from previouslydecoded blocks of the current picture. When the video picture is codedas an inter coded (i.e., B, or P) slice, inter prediction unit 344 (e.g.motion compensation unit) of mode application unit 360 is configured toproduce prediction blocks 365 for a video block of the current videoslice based on the motion vectors and other syntax elements receivedfrom entropy decoding unit 304. For inter prediction, the predictionblocks may be produced from one of the reference pictures within one ofthe reference picture lists. Video decoder 30 may construct thereference frame lists, List 0 and List 1, using default constructiontechniques based on reference pictures stored in DPB 330. The same orsimilar may be applied for or by embodiments using tile groups (e.g.video tile groups) and/or tiles (e.g. video tiles) in addition oralternatively to slices (e.g. video slices), e.g. a video may be codedusing I, P or B tile groups and/or tiles.

Mode application unit 360 is configured to determine the predictioninformation for a video block of the current video slice by parsing themotion vectors or related information and other syntax elements, anduses the prediction information to produce the prediction blocks for thecurrent video block being decoded. For example, the mode applicationunit 360 uses some of the received syntax elements to determine aprediction mode (e.g., intra or inter prediction) used to code the videoblocks of the video slice, an inter prediction slice type (e.g., Bslice, P slice, or GPB slice), construction information for one or moreof the reference picture lists for the slice, motion vectors for eachinter encoded video block of the slice, inter prediction status for eachinter coded video block of the slice, and other information to decodethe video blocks in the current video slice. The same or similar may beapplied for or by embodiments using tile groups (e.g. video tile groups)and/or tiles (e.g. video tiles) in addition or alternatively to slices(e.g. video slices), e.g. a video may be coded using I, P or B tilegroups and/or tiles.

Embodiments of the video decoder 30 as shown in FIG. 3 may be configuredto partition and/or decode the picture by using slices (also referred toas video slices), wherein a picture may be partitioned into or decodedusing one or more slices (typically non-overlapping), and each slice maycomprise one or more blocks (e.g. CTUs).

Embodiments of the video decoder 30 as shown in FIG. 3 may be configuredto partition and/or decode the picture by using tile groups (alsoreferred to as video tile groups) and/or tiles (also referred to asvideo tiles), wherein a picture may be partitioned into or decoded usingone or more tile groups (typically non-overlapping), and each tile groupmay comprise, e.g. one or more blocks (e.g. CTUs) or one or more tiles,wherein each tile, e.g. may be of rectangular shape and may comprise oneor more blocks (e.g. CTUs), e.g. complete or fractional blocks.

Other variations of the video decoder 30 can be used to decode theencoded picture data 21. For example, the decoder 30 can produce theoutput video stream without the loop filtering unit 320. For example, anon-transform based decoder 30 can inverse-quantize the residual signaldirectly without the inverse-transform processing unit 312 for certainblocks or frames. In another implementation, the video decoder 30 canhave the inverse-quantization unit 310 and the inverse-transformprocessing unit 312 combined into a single unit.

It should be understood that, in the encoder 20 and the decoder 30, aprocessing result of a current step may be further processed and thenoutput to the next step. For example, after interpolation filtering,motion vector derivation or loop filtering, a further operation, such asClip or shift, may be performed on the processing result of theinterpolation filtering, motion vector derivation or loop filtering.

It should be noted that further operations may be applied to the derivedmotion vectors of current block (including but not limit to controlpoint motion vectors of affine mode, sub-block motion vectors in affine,planar, ATMVP modes, temporal motion vectors, and so on). For example,the value of motion vector is constrained to a predefined rangeaccording to its representing bit. If the representing bit of motionvector is bitDepth, then the range is −2{circumflex over( )}(bitDepth−1)˜2 {circumflex over ( )}(bitDepth-1)−1, where“{circumflex over ( )}” means exponentiation. For example, if bitDepthis set equal to 16, the range is −32768˜32767; if bitDepth is set equalto 18, the range is −131072˜131071. For example, the value of thederived motion vector (e.g. the MVs of four 4×4 sub-blocks within one8×8 block) is constrained such that the max difference between integerparts of the four 4×4 sub-block MVs is no more than N samples, such asno more than 1 sample.

FIG. 4 is a schematic diagram of a video coding device 400 according toan embodiment of the disclosure. The video coding device 400 is suitablefor implementing the disclosed embodiments as described herein. In anembodiment, the video coding device 400 may be a decoder such as videodecoder 30 of FIG. 1A or an encoder such as video encoder 20 of FIG. 1A.

The video coding device 400 comprises ingress ports 410 (or input ports410) and receiver units (Rx) 420 for receiving data; a processor, logicunit, or central processing unit (CPU) 430 to process the data;transmitter units (Tx) 440 and egress ports 450 (or output ports 450)for transmitting the data; and a memory 460 for storing the data. Thevideo coding device 400 may also comprise optical-to-electrical (OE)components and electrical-to-optical (EO) components coupled to theingress ports 410, the receiver units 420, the transmitter units 440,and the egress ports 450 for egress or ingress of optical or electricalsignals.

The processor 430 is implemented by hardware and software. The processor430 may be implemented as one or more CPU chips, cores (e.g., as amulti-core processor), FPGAs, ASICs, and DSPs. The processor 430 is incommunication with the ingress ports 410, receiver units 420,transmitter units 440, egress ports 450, and memory 460. The processor430 comprises a coding module 470. The coding module 470 implements thedisclosed embodiments described above. For instance, the coding module470 implements, processes, prepares, or provides the various codingoperations. The inclusion of the coding module 470 therefore provides asubstantial improvement to the functionality of the video coding device400 and effects a transformation of the video coding device 400 to adifferent state. Alternatively, the coding module 470 is implemented asinstructions stored in the memory 460 and executed by the processor 430.

The memory 460 may comprise one or more disks, tape drives, andsolid-state drives and may be used as an over-flow data storage device,to store programs when such programs are selected for execution, and tostore instructions and data that are read during program execution. Thememory 460 may be, for example, volatile and/or non-volatile and may bea read-only memory (ROM), random access memory (RAM), ternarycontent-addressable memory (TCAM), and/or static random-access memory(SRAM).

FIG. 5 is a simplified block diagram of an apparatus 500 that may beused as either or both of the source device 12 and the destinationdevice 14 from FIG. 1A according to an exemplary embodiment.

A processor 502 in the apparatus 500 can be a central processing unit.Alternatively, the processor 502 can be any other type of device, ormultiple devices, capable of manipulating or processing informationnow-existing or hereafter developed. Although the disclosedimplementations can be practiced with a single processor as shown, e.g.,the processor 502, advantages in speed and efficiency can be achievedusing more than one processor.

A memory 504 in the apparatus 500 can be a read only memory (ROM) deviceor a random access memory (RAM) device in an implementation. Any othersuitable type of storage device can be used as the memory 504. Thememory 504 can include code and data 506 that is accessed by theprocessor 502 using a bus 512. The memory 504 can further include anoperating system 508 and application programs 510, the applicationprograms 510 including at least one program that permits the processor502 to perform the methods described here. For example, the applicationprograms 510 can include applications 1 through N, which further includea video coding application that performs the methods described here.

The apparatus 500 can also include one or more output devices, such as adisplay 518. The display 518 may be, in one example, a touch sensitivedisplay that combines a display with a touch sensitive element that isoperable to sense touch inputs. The display 518 can be coupled to theprocessor 502 via the bus 512.

Although depicted here as a single bus, the bus 512 of the apparatus 500can be composed of multiple buses. Further, the secondary storage 514can be directly coupled to the other components of the apparatus 500 orcan be accessed via a network and can comprise a single integrated unitsuch as a memory card or multiple units such as multiple memory cards.The apparatus 500 can thus be implemented in a wide variety ofconfigurations.

The following first describes concepts in this application.

1. Inter prediction mode

In HEVC, two inter prediction modes are used: an advanced motion vectorprediction (advanced motion vector prediction, AMVP) mode and a merge(merge) mode.

In the AMVP mode, spatially or temporally neighboring encoded blocks(denoted as neighboring blocks) of a current block are first traversed;a candidate motion vector list (which may also be referred to as amotion information candidate list) is constructed based on motioninformation of the neighboring blocks; and then an optimal motion vectoris determined from the candidate motion vector list based on arate-distortion cost. Candidate motion information with a minimumrate-distortion cost is used as a motion vector predictor (MVP) of thecurrent block. Both locations of the neighboring blocks and a traversalorder thereof are predefined. The rate-distortion cost is calculatedaccording to formula (1), where J represents the rate-distortion cost(RD cost), SAD is a sum of absolute differences (SAD) between originalsample values and predicted sample values obtained through motionestimation by using a candidate motion vector predictor, R represents abit rate, and represents a Lagrange multiplier. An encoder sidetransfers an index value of the selected motion vector predictor in thecandidate motion vector list and a reference frame index value to adecoder side. Further, motion search is performed in a neighborhood atthe MVP, to obtain an actual motion vector of the current block. Theencoder side transfers a difference (motion vector difference) betweenthe MVP and the actual motion vector to the decoder side.

J=SAD+λR  (1)

In the merge mode, a candidate motion vector list is first constructedbased on motion information of spatially or temporally neighboringencoded blocks of a current block. Then optimal motion information isdetermined from the candidate motion vector list as motion informationof the current block based on a rate-distortion cost. An index value(denoted as a merge index hereinafter) of the location of optimal motioninformation in the candidate motion vector list is transferred to adecoder side. Spatial and temporal candidate motion information of thecurrent block are shown in FIG. 6. The spatial candidate motioninformation is from five spatially neighboring blocks (A0, A1, B0, B1,and B2). If a neighboring block is unavailable (the neighboring blockdoes not exist, or the neighboring block is not encoded, or a predictionmode used for the neighboring block is not an inter prediction mode),motion information of this neighboring block is not added to thecandidate motion vector list. The temporal candidate motion informationof the current block is obtained by scaling an MV of a block at thecorresponding location in a reference frame based on picture ordercounts (POC) of the reference frame and a current frame. Whether a blockat a T location in the reference frame is available is first determined,and if the block is unavailable, a block at a C location is selected.

Similar to the AMVP mode, in the merge mode, both locations of theneighboring blocks and a traversal order thereof are also predefined. Inaddition, the locations of the neighboring blocks and the transversalorder thereof may be different in different modes.

It can be learned that, a candidate motion vector list (also referred toas a list of candidates, which may be referred to as a candidate listfor short) needs to be maintained in both the AMVP mode and the mergemode. Each time before new motion information is added to a candidatelist, whether same motion information already exists in the list isfirst checked. If the same motion information already exists, the motioninformation is not added to the list. This checking process is referredto as pruning of the candidate motion vector list. Pruning of the listis to avoid the same motion information to be included in the list, andthereby avoid redundant rate-distortion cost calculation.

In inter prediction in HEVC, same motion information is used for allsamples in a coding block, and then motion compensation is performedbased on the motion information, to obtain predictors of the samples ofthe coding block. In the coding block, however, not all samples havesame motion characteristics. Using the same motion information for thecoding block may result inaccurate motion compensation prediction andmore residual information.

In existing video coding standards, block matching motion estimationbased on a translational motion model is applied, and it is assumed thatmotion of all samples in a block is consistent. However, in the realworld, there are a variety of motion. Many objects are innon-translational motion, for example, a rotating object, a rollercoaster spinning in different directions, a display of fireworks, andsome stunts in movies, especially a moving object in a User GeneratedContent (UGC) scenario. For these moving objects, if a block motioncompensation technology based on a translational motion model in theexisting coding standards is used for coding, coding efficiency may begreatly affected. As such, a non-translational motion model, forexample, an affine motion model, is introduced to further improve thecoding efficiency.

Base on this, due to different motion models, the AMVP mode may beclassified into a translational model—based AMVP mode and anon-translational model-based AMVP mode (for example, an affinemodel-based AMVP mode), and the merge mode may be classified into atranslational model-based merge mode and a non-translational model-basedmerge mode (for example, an affine model-based merge mode).

2. Non-Translational Motion Model

Prediction based on a non-translational motion model refers to that, asame motion model is used on both encoder and decoder sides to derivemotion information of each sub-block (also referred to as a sub motioncompensation unit or a basic motion compensation unit) in a currentblock, and motion compensation is performed based on the motioninformation of the sub-block to obtain a prediction block, therebyimproving prediction efficiency. Common non-translational motion modelsinclude a 4-parameter affine motion model and a 6-parameter affinemotion model.

The sub motion compensation unit (also referred to as a sub-block) inthis embodiment of this application may be a sample or a N₁×N₂ sampleblock obtained based on a particular partitioning method, where both N₁and N₂ are positive integers, and N₁ may be equal to N₂ or may be notequal to N₂.

The 4-parameter affine motion model is expressed as formula (2):

$\begin{matrix}\left\{ \begin{matrix}{{vx} = {a_{1} + {a_{3}x} + {a_{4}y}}} \\{{vy} = {a_{2} - {a_{4}x} + {a_{3}y}}}\end{matrix} \right. & (2)\end{matrix}$

The 4-parameter affine motion model may be represented by motion vectorsof two samples and their coordinates relative to a top-left sample ofthe current block. A sample used for representing a motion modelparameter is referred to as a control point. If the top-left sample (0,0) and a top-right sample (W, 0) are used as control points, respectivemotion vectors (vx0, vy0) and (vx1, vy1) of the top-left control pointand a top-right control point of the current block are first determined.Then motion information of each sub motion compensation unit of thecurrent block is obtained according to formula (3), where (x, y) is acoordinate (such as a coordinate of a top-left sample) of a sub motioncompensation unit relative to the top-left sample of the current block,and W represents a width of the current block. It should be understoodthat other control points may alternatively be used. For example,samples at locations (2, 2) and (W+2, 2), or (−2, −2) and (W−2, −2) maybe used as the control points. The selection of the control points arenot limited by the examples listed herein.

$\begin{matrix}\left\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} - {\frac{{vy}_{1} - {vy}_{0}}{W}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vx}_{1} - {vx}_{0}}{W}y} + {vy}_{0}}}\end{matrix} \right. & (3)\end{matrix}$

The 6-parameter affine motion model is expressed as formula (4):

$\begin{matrix}\left\{ \begin{matrix}{{vx} = {a_{1} + {a_{3}x} + {a_{4}y}}} \\{{vy} = {a_{2} + {a_{5}x} + {a_{6}y}}}\end{matrix} \right. & (4)\end{matrix}$

The 6-parameter affine motion model may be represented by motion vectorsof three samples and their coordinates relative to a top-left sample ofthe current block. If the top-left sample (0, 0), the top-right sample(W, 0), and the bottom-left sample (0, H) of the current block are usedas control points, respective motion vectors (vx0, vy0), (vx1, vy1), and(vx2, vy2) of the top-left control point, the top-right control point,and the bottom-left control point of the current block are firstdetermined. Then motion information of each sub motion compensation unitof the current block is obtained according to formula (5), where (x, y)is coordinates of a sub motion compensation unit relative to thetop-left sample of the current block, and W and H represent a width anda height of the current block, respectively. It should be understoodthat other control points may alternatively be used. For example,samples at locations (2, 2), (W+2, 2), and (2, H+2), or (−2, −2), (W−2,−2), and (−2, H−2) may be used as the control points. These examples arenot limiting.

$\begin{matrix}\left\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} + {\frac{{vx}_{2} - {vy}_{0}}{H}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vy}_{2} - {vx}_{0}}{H}y} + {vy}_{0}}}\end{matrix} \right. & (5)\end{matrix}$

A coding block that is predicted by using the affine motion model isreferred to as an affine coded block.

Generally, motion information of a control point of an affine codedblock may be obtained by using an affine motion model-based advancedmotion vector prediction (AMVP) mode or an affine motion model-basedmerge mode.

The motion information of the control point of the current coding blockmay be obtained by using an inherited control point motion vectorprediction method or a constructed control point motion vectorprediction method.

3. Inherited control point motion vector prediction method

The inherited control point motion vector prediction method refers tousing a motion model of a neighboring encoded affine coded block todetermine candidate control point motion vectors of a current block.

A current block shown in FIG. 7 is used as an example. Blocks atneighboring locations around the current block are traversed in aspecified order, for example, A1->B1->B0->A0->B2, to find an affinecoded block in which a block at a neighboring location of the currentblock is located, and obtain control point motion information of theaffine coded block. Further, a control point motion vector (for themerge mode) or a control point motion vector predictor (for the AMVPmode) of the current block is derived by using a motion modelconstructed based on the control point motion information of the affinecoded block. The order A1->B1->B0->A0->B2 mentioned above is merely usedas an example and should not be construed as limiting. Another order canalso be used. In addition, the blocks at neighboring locations are notlimited to A1, B1, B0, A0, and B2 and various block at neighboringlocations can be used.

A block at a neighboring location may a sample or a sample block of apreset size obtained based on a particular partitioning method. Forexample, the sample block may be a 4×4 sample block, a 4×2 sample block,or a sample block of another size. These block sizes are forillustration purposes and should not be construed as limiting.

The following describes a determining process by using A1 as an example,and similar process can be employed for other cases.

As shown in FIG. 7, if a coding block in which A1 is located is a4-parameter affine coded block, the motion vector (vx4, vy4) of thetop-left sample (x4, y4) and the motion vector (vx5, vy5) of thetop-right sample (x5, y5) of the affine coded block are obtained. Themotion vector (vx0, vy0) of the top-left sample (x0, y0) of the currentaffine coded block is calculated according to formula (6), and themotion vector (vx1, vy1) of the top-right sample (x1, y1) of the currentaffine coded block is calculated according to formula (7).

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{vx}_{4} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{0} - x_{4}} \right)} - {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}} \\{{vy}_{0} = {{vy}_{4} + {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{0} - x_{4}} \right)} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}}\end{matrix} \right. & (6) \\\left\{ \begin{matrix}{{vx}_{1} = {{vx}_{4} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{1} - x_{4}} \right)} - {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{1} - y_{4}} \right)}}} \\{{vy}_{1} = {{vy}_{4} + {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{1} - x_{4}} \right)} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{1} - y_{4}} \right)}}}\end{matrix} \right. & (7)\end{matrix}$

A combination of the motion vector (vx0, vy0) of the top-left sample(x0, y0) and the motion vector (vx1, vy1) of the top-right sample (x1,y1) of the current block that are obtained based on the affine codedblock in which A1 is located is the candidate control point motionvectors of the current block.

If a coding block in which A1 is located is a 6-parameter affine codedblock, the motion vector (vx4, vy4) of the top-left sample (x4, y4), themotion vector (vx5, vy5) of the top-right sample (x5, y5), and themotion vector (vx6, vy6) of the bottom-left sample (x6, y6) of theaffine coded block are obtained. The motion vector (vx0, vy0) of thetop-left sample (x0, y0) of the current block is calculated according toformula (8). The motion vector (vx1, vy1) of the top-right sample (x1,y1) of the current block is calculated according to formula (9). Themotion vector (vx2, vy2) of the bottom-left sample (x2, y2) of thecurrent block is calculated according to formula (10).

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{vx}_{4} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{0} - x_{4}} \right)} + {\frac{\left( {{vx}_{6} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}} \\{{vy}_{0} = {{vy}_{4} + {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{0} - x_{4}} \right)} + {\frac{\left( {{vy}_{6} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}}\end{matrix} \right. & (8) \\\left\{ \begin{matrix}{{vx}_{1} = {{vx}_{4} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{1} - x_{4}} \right)} + {\frac{\left( {{vx}_{6} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}} \\{{vy}_{1} = {{vy}_{4} + {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{1} - x_{4}} \right)} + {\frac{\left( {{vy}_{6} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{0} - y_{4}} \right)}}}\end{matrix} \right. & (9) \\\left\{ \begin{matrix}{{vx}_{2} = {{vx}_{4} + {\frac{\left( {{vx}_{5} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{2} - x_{4}} \right)} + {\frac{\left( {{vx}_{6} - {vx}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{2} - y_{4}} \right)}}} \\{{vy}_{2} = {{vy}_{4} + {\frac{\left( {{vy}_{5} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {x_{2} - x_{4}} \right)} + {\frac{\left( {{vy}_{6} - {vy}_{4}} \right)}{x_{5} - x_{4}} \times \left( {y_{2} - y_{4}} \right)}}}\end{matrix} \right. & (10)\end{matrix}$

A combination of the motion vector (vx0, vy0) of the top-left sample(x0, y0), the motion vector (vx1, vy1) of the top-right sample (x1, y1),and the motion vector (vx2, vy2) of the bottom-left sample (x2, y2) ofthe current block that are obtained based on the affine coded block inwhich A1 is located is the candidate control point motion vector of thecurrent block.

It should be noted that other motion models, candidate locations, andsearch and traversal orders are also applicable to this application.Details are not described in this embodiment of this application.

It should be noted that methods in which other control points are usedto represent motion models of neighboring and current coding blocks arealso applicable to this application. Details are not described herein.

4. Constructed control point motion vectors prediction method 1

The constructed control point motion vector prediction method refers tocombining motion vectors of neighboring encoded blocks around a controlpoint of a current block as a control point motion vector of a currentaffine coded block, without considering whether the neighboring encodedblocks are affine coded blocks.

Motion vectors of the top-left sample and the top-right sample of thecurrent block are determined by using motion information of theneighboring encoded blocks around the current coding block. FIG. 8A isused as an example to describe the constructed control point motionvector prediction method. It should be noted that FIG. 8A is merely anexample and should not be construed as limiting.

As shown in FIG. 8A, motion vectors of neighboring encoded blocks A2,B2, and B3 of the top-left sample are used as candidate motion vectorsfor the motion vector of the top-left sample of the current block, andmotion vectors of neighboring encoded blocks B1 and B0 of the top-rightsample are used as candidate motion vectors for the motion vector of thetop-right sample of the current block. The candidate motion vectors ofthe top-left sample and the top-right sample are combined to constitutea plurality of 2-tuples. Motion vectors of two encoded blocks includedin a 2-tuple may be used as candidate control point motion vectors ofthe current block, as shown in the following formula (11A):

{v _(A2) ,v _(B1) },{v _(A2) ,v _(B0) },{v _(B2) ,v _(B1) },{v _(B2) ,v_(B0) },{v _(B3) ,v _(B1) },{v _(B3) ,v _(B0)}  (11A)

where v_(A2) represents a motion vector of A2, v_(B1) represents amotion vector of B1, v_(B0) represents a motion vector of B0, v_(B2)represents a motion vector of B2, and v_(B3) represents a motion vectorof B3.

As shown in FIG. 8A, motion vectors of neighboring encoded blocks A2,B2, and B3 of the top-left sample are used as candidate motion vectorsfor the motion vector of the top-left sample of the current block,motion vectors of neighboring encoded blocks B1 and B0 of the top-rightsample are used as candidate motion vectors for the motion vector of thetop-right sample of the current block, and motion vectors of neighboringencoded blocks A0 and A1 of the bottom-left sample are used as candidatemotion vectors for the motion vector of the bottom-left sample of thecurrent block. The candidate motion vectors of the top-left sample, thetop-right sample, and the bottom-left sample are combined to constitutea 3-tuple. Motion vectors of three encoded blocks included in a 3-tuplemay be used as candidate control point motion vectors of the currentblock, as shown in the following formulas (11B) and (11C):

{v _(A2) ,v _(B1) ,v _(A0) },{v _(A2) ,v _(B0) ,v _(A0) },{v _(B2) ,v_(B1) ,v _(A0) },{v _(B2) ,v _(B0) ,v _(A0) },{v _(B3) ,v _(B1) ,v _(A0)},{v _(B3) ,v _(B0) ,v _(A0)}  (11B)

{v _(A2) ,v _(B1) ,v _(A1) },{v _(A2) ,v _(B0) ,v _(A1) },{v _(B2) ,v_(B1) ,v _(A1) },{v _(B2) ,v _(B0) ,v _(A1) },{v _(B3) ,v _(B1) ,v _(A1)},{v _(B3) ,v _(B0) ,v _(A1)}  (11C)

where v_(A2) represents a motion vector of A2, v_(B1) represents amotion vector of B1, v_(B0) represents a motion vector of B0, v_(B2)represents a motion vector of B2, v_(B3) represents a motion vector ofB3, v_(A0) represents a motion vector of A0, and v_(A1) represents amotion vector of A1.

It should be noted that other methods for combining control point motionvectors are also applicable to this application. Details are notdescribed herein.

It should be noted that methods in which other control points are usedto represent motion models of neighboring and current coding blocks arealso applicable to this application. Details are not described herein.

5. Constructed control point motion vectors prediction method 2, asshown in FIG. 8B:

Step 501: Obtaining motion information of control points of a currentblock.

For example, in FIG. 8A, CP_(k) (k=1, 2, 3, 4) represents a k^(th)control point. A0, A1, A2, B0, B1, B2, and B3 are spatially neighboringlocations of the current block and are used to predict CP1, CP2, or CP3,and T is a temporally neighboring location of the current block and isused to predict CP4.

It is assumed that coordinates of CP1, CP2, CP3, and CP4 are (0, 0), (W,0), (H, 0), and (W, H), respectively, where W and H represent a widthand a height of the current block.

For each control point, motion information thereof is obtained in thefollowing order:

(1) For CP1, a check order is B2->A2->B3. If B2 is available, motioninformation of B2 is used for CP1. Otherwise, A2 and B3 are checkedsequentially. If motion information of all the three locations isunavailable, motion information of CP1 cannot be obtained.

(2) For CP2, a check order is B0->B1. If B0 is available, motioninformation of B0 is used for CP2. Otherwise, B1 is checked. If motioninformation of both the locations is unavailable, motion information ofCP2 cannot be obtained.

(3) For CP3, a check order is A0->A1. If A0 is available, motioninformation of A0 is used for CP3. Otherwise, A1 is checked. If motioninformation of both the locations is unavailable, motion information ofCP3 cannot be obtained.

(4) For CP4, motion information of T is used.

Herein, that X is available means that the block X (e.g., A0, A1, A2,B0, B1, B2, B3, or T) is already encoded and an inter prediction mode isused. Otherwise, X is unavailable.

It should be noted that other methods for obtaining motion informationof a control point are also applicable to this application. Details arenot described herein.

Step 502: Combining the motion information of the control points, toobtain constructed control point motion information.

Motion information of two control points is combined to constitute a2-tuple, to construct a 4-parameter affine motion model. Combinations ofmotion information of the two control points may be {CP1, CP4}, {CP2,CP3}, {CP1, CP2}, {CP2, CP4}, {CP1, CP3}, and {CP3, CP4}. For example, a4-parameter affine motion model constructed by using a 2-tuple includingmotion information of the control points CP1 and CP2 may be denoted asAffine (CP1, CP2).

Motion information of three control points is combined to constitute a3-tuple, to construct a 6-parameter affine motion model. Combinations ofmotion information of the three control points may be {CP1, CP2, CP4},{CP1, CP2, CP3}, {CP2, CP3, CP4}, and {CP1, CP3, CP4}. For example, a6-parameter affine motion model constructed by using a 3-tuple includingmotion information of the control points CP1, CP2, and CP3 may bedenoted as Affine (CP1, CP2, CP3).

Motion information of four control points is combined to constitute a4-tuple, to construct an 8-parameter bilinear motion model. An8-parameter bilinear motion model constructed by using a 4-tupleincluding motion information of the control points CP1, CP2, CP3, andCP4 may be denoted as Bilinear (CP1, CP2, CP3, CP4).

In this embodiment of this application, for ease of description, acombination of motion information of two control points (or two encodedblocks) is simply referred to as a 2-tuple, a combination of motioninformation of three control points (or three encoded blocks) is simplyreferred to as a 3-tuple, and a combination of motion information offour control points (or four encoded blocks) is simply referred to as a4-tuple.

These models are traversed in a preset order. If motion information of acontrol point corresponding to a combination model is unavailable, it isconsidered that the model is unavailable. Otherwise, a reference frameindex of the model is determined, and a control point motion vector isscaled. If motion information of all control points after scaling isconsistent, the model is invalid. If all motion information of controlpoints controlling the model is available and the model is valid, motioninformation of the control points constructing the model is added to amotion information candidate list.

A control point motion vector scaling method is shown in formula (12):

$\begin{matrix}{{MV}_{s} = {\frac{{CurPoc} - {DesPoc}}{{CurPoc} - {SrcPoc}} \times {MV}}} & (12)\end{matrix}$

where CurPoc represents the POC number of a current frame, DesPocrepresents the POC number of a reference frame of the current block,SrcPoc represents the POC number of a reference frame of a controlpoint, Mv_(S) represents the motion vector obtained after scaling, andMV represents the motion vector of a control point.

It should be noted that a combination of different control points may beconverted into control points at a same location.

For example, a 4-parameter affine motion model obtained through acombination {CP1, CP4}, {CP2, CP3}, {CP2, CP4}, {CP1, CP3}, or {CP3,CP4} is converted into a representation by {CP1, CP2} or {CP1, CP2,CP3}. The conversion method includes: substituting the motion vectorsand coordinate information of the control points {CP1, CP4}, {CP2, CP3},{CP2, CP4}, {CP1, CP3}, or {CP3, CP4} into formula (2) to obtain themodel parameters; and then substituting coordinate information of {CP1,CP2} into formula (3), to obtain a motion vector of the control points{CP1, CP2}.

More directly, conversion may be performed according to the followingformulas (13) to (21), where W represents the width of the currentblock, and H represents the height of the current block. In formulas(13) to (21), (vx₀, vy₀) represents a motion vector of CP1, (vx₁, vy₁)represents a motion vector of CP2, (vx₂, vy₂) represents a motion vectorof CP3, and (vx₃, vy₃) represents a motion vector of CP4.

{CP1, CP2} may be converted into {CP1, CP2, CP3} by using the followingformula (13). In other words, the motion vector of CP3 in {CP1, CP2,CP3} may be determined by using formula (13):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{2} = {{{- \frac{{vy}_{1} - {vy}_{0}}{W}}H} + {vx}_{0}}} \\{{vy}_{2} = {{{+ \frac{{vx}_{1} - {vx}_{0}}{W}}H} + {vy}_{0}}}\end{matrix} \right. & (13)\end{matrix}$

{CP1, CP3} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingthe following formula (14):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{1} = {{{+ \frac{{vy}_{2} - {vy}_{0}}{H}}W} + {vx}_{0}}} \\{{vy}_{1} = {{{- \frac{{vx}_{2} - {vx}_{0}}{H}}W} + {vy}_{0}}}\end{matrix} \right. & (14)\end{matrix}$

{CP2, CP3} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingthe following formula (15):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{\frac{{vx}_{2} - {vx}_{1}}{{W*W} + {H*H}}W*W} - {\frac{{vy}_{2} - {vy}_{1}}{{W*W} + {H*H}}H*W} + {vx}_{1}}} \\{{vy}_{0} = {{\frac{{vy}_{2} - {vy}_{1}}{{W*W} + {H*H}}W*W} + {\frac{{vx}_{2} - {vx}_{1}}{{W*W} + {H*H}}H*W} + {vy}_{1}}}\end{matrix} \right. & (15)\end{matrix}$

{CP1, CP4} may be converted into {CP1, CP2} or {CP1, CP2, CP3} by usingthe following formula (16) or (17):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{1} = {{\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}W*W} + {\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}H*W} + {vx}_{0}}} \\{{vy}_{1} = {{\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}W*W} - {\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*W} + {vy}_{0}}}\end{matrix} \right. & (16) \\\left\{ \begin{matrix}{{vx}_{2} = {{\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*H} - {\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}H*W} + {vx}_{0}}} \\{{vy}_{2} = {{\frac{{vy}_{3} - {vy}_{0}}{{W*W} + {H*H}}W*H} + {\frac{{vx}_{3} - {vx}_{0}}{{W*W} + {H*H}}H*H} + {vy}_{0}}}\end{matrix} \right. & (17)\end{matrix}$

{CP2, CP4} may be converted into {CP1, CP2} by using the followingformula (18), and {CP2, CP4} may be converted into {CP1, CP2, CP3} byusing the following formulas (18) and (19):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{{- \frac{{vy}_{3} - {vy}_{1}}{H}}W} + {vx}_{1}}} \\{{vy}_{0} = {{{+ \frac{{vx}_{3} - {vx}_{1}}{H}}W} + {vy}_{1}}}\end{matrix} \right. & (18) \\\left\{ \begin{matrix}{{vx}_{2} = {{{- \frac{{vy}_{3} - {vy}_{1}}{H}}W} + {vx}_{3}}} \\{{vy}_{2} = {{{+ \frac{{vx}_{3} - {vx}_{1}}{H}}W} + {vy}_{3}}}\end{matrix} \right. & (19)\end{matrix}$

{CP3, CP4} may be converted into {CP1, CP2} by using the followingformula (20), and {CP3, CP4} may be converted into {CP1, CP2, CP3} byusing the following formulas (20) and (21):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{{+ \frac{{vy}_{3} - {vy}_{2}}{W}}H} + {vx}_{2}}} \\{{vy}_{0} = {{{- \frac{{vx}_{3} - {vx}_{2}}{W}}H} + {vy}_{2}}}\end{matrix} \right. & (20) \\\left\{ \begin{matrix}{{vx}_{1} = {{{+ \frac{{vy}_{3} - {vy}_{2}}{W}}H} + {vx}_{3}}} \\{{vy}_{1} = {{{- \frac{{vx}_{3} - {vx}_{2}}{W}}H} + {vy}_{3}}}\end{matrix} \right. & (21)\end{matrix}$

For example, a 6-parameter affine motion model obtained through acombination {CP1, CP2, CP4}, {CP2, CP3, CP4}, or {CP1, CP3, CP4} can beconverted into a representation by {CP1, CP2, CP3}. The conversionmethod includes: substituting a motion vector and coordinate informationof the control points {CP1, CP2, CP4}, {CP2, CP3, CP4}, or {CP1, CP3,CP4} into formula (4), to obtain a model parameter; and thensubstituting coordinate information of {CP1, CP2, CP3} into formula (5),to obtain the motion vectors of {CP1, CP2, CP3}.

More directly, conversion may be performed according to the followingformulas (22) to (24), where W represents the width of the currentblock, and H represents the height of the current block. In the formulas(13) to (21), (vx₀, vy₀) represents a motion vector of CP1, (vx₁, vy₁)represents a motion vector of CP2, (vx₂, vy₂) represents a motion vectorof CP3, and (vx₃, vy₃) represents a motion vector of CP4.

{CP1, CP2, CP4} may be converted into {CP1, CP2, CP3} by using thefollowing formula (22):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{2} = {{vx}_{3} + {vx}_{0} - {vx}_{1}}} \\{{vy}_{2} = {{vy}_{3} + {vy}_{0} - {vy}_{1}}}\end{matrix} \right. & (22)\end{matrix}$

{CP2, CP3, CP4} may be converted into {CP1, CP2, CP3} by using thefollowing formula (23):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{0} = {{vx}_{1} + {vx}_{2} - {vx}_{3}}} \\{{vy}_{0} = {{vy}_{1} + {vy}_{2} - {vy}_{3}}}\end{matrix} \right. & (23)\end{matrix}$

{CP1, CP3, CP4} may be converted into {CP1, CP2, CP3} by using thefollowing formula (24):

$\begin{matrix}\left\{ \begin{matrix}{{vx}_{1} = {{vx}_{3} + {vx}_{0} - {vx}_{2}}} \\{{vy}_{1} = {{vy}_{3} + {vy}_{0} - {vy}_{2}}}\end{matrix} \right. & (24)\end{matrix}$

6. Affine motion model-based advanced motion vector prediction mode(Affine AMVP mode)

(1) Constructing a Candidate Motion Vector List

A candidate motion vector list for the affine motion model-based AMVPmode is constructed by using the inherited control point motion vectorprediction method and/or the constructed control point motion vectorprediction method described above. In this embodiment of thisapplication, the candidate motion vector list for the affine motionmodel-based AMVP mode may be referred to as a control point motionvector predictor candidate list. The motion vector predictor of eachcontrol point includes motion vectors of two (4-parameter affine motionmodel) control points or motion vectors of three (6-parameter affinemotion model) control points.

Optionally, the control point motion vector predictor candidate list ispruned and sorted according to a particular rule, and may be truncatedor padded to include a particular quantity of control point motionvector predictors candidate.

(2) Determining an Optimal Control Point Motion Vector PredictorsCandidate

On an encoder side, the motion vector of each sub motion compensationunit in the current coding block is obtained based on each control pointmotion vector predictors candidate (e.g. a X-tuple candidate) in thecontrol point motion vector predictor candidate list by using formula(3) or (5). The obtained motion vector can be used to obtain a samplevalue at a corresponding location in a reference frame to which themotion vector of the sub motion compensation unit points. This samplevalue is used as a predictor to perform motion compensation using theaffine motion model. An average difference between an original value anda prediction value of each sample in the current coding block iscalculated. A control point motion vector predictors candidatecorresponding to the minimum average difference is selected as theoptimal control point motion vector predictors candidate, and used asmotion vector predictors of two or three control points of the currentcoding block. An index number representing the location of the optimalcontrol point motion vector predictors candidate (e.g. a X-tuplecandidate) in the control point motion vector predictors candidate listis encoded into a bitstream and sent to a decoder.

On a decoder side, the index number is parsed, and the control pointmotion vector predictors (CPMVPs) (e.g. X-tuple candidate) aredetermined from the control point motion vector predictor candidate listbased on the index number.

(3) Determining Control Point Motion Vectors

On the encoder side, the control point motion vector predictor is usedas a search start point for motion search within a specific searchrange, to obtain control point motion vectors (CPMVs). The differences(control point motion vectors differences, CPMVDs) between therespective control point motion vectors and the control point motionvector predictors are transferred to the decoder side.

On the decoder side, the control point motion vector differences areobtained by parsing the bit stream and added to the control point motionvector predictors respectively, to obtain the respective control pointmotion vectors.

7. Affine Merge Mode

A control point motion vectors merge candidate list is constructed byusing the inherited control point motion vector prediction method and/orthe constructed control point motion vector prediction method describedabove.

Optionally, the control point motion vectors merge candidate list ispruned and sorted according to a particular rule, and may be truncatedor padded to a particular quantity.

On the encoder side, a motion vector of each sub motion compensationunit (a sample or a N₁×N₂ sample block obtained based on a particularpartitioning method) in the current coding block is obtained based oneach control point motion vectors candidate (e.g. X-tuple candidate) inthe merge candidate list by using formula ((3) or (5). The obtainedmotion vector can be used to obtain sample values at a location in areference frame to which the motion vector of each sub motioncompensation unit points. These sample values are used as predictedsample values to perform affine motion compensation. An averagedifference between an original value and a predicted value of eachsample in the current coding block is calculated. The control pointmotion vectors (CPMVs) candidate (e.g. 2-tuple candidate or 3-tuplecandidate) corresponding to a minimum average difference is selected asmotion vectors of two or three control points of the current codingblock. An index number representing the location of the control pointmotion vector in the candidate list is encoded into the bitstream of thevideo and sent to the decoder.

On the decoder side, the index number is parsed, and the control pointmotion vectors (CPMVs) are determined from the control point motionvector merge candidate list based on the index number.

In addition, it should be noted that in this application, “at least one”means one or more, and “a plurality of” means at least two. The term“and/or” describes an association relationship for describing associatedobjects and represents that three relationships may exist. For example,A and/or B may represent the following cases: Only A exists, both A andB exist, and only B exists, where A and B may be in a singular or pluralform. The character “/” generally indicates an “or” relationship betweenthe associated objects. “At least one (one piece) of the following[items]” or a similar expression refers to any combination of theseitems, including any combination of singular items (pieces) or pluralitems (pieces). For example, at least one (one piece) of a, b, or c mayrepresent: a, b, c, a and b, a and c, b and c, or a and b and c, wherea, b, and c may be singular or plural.

In this application, when the inter prediction mode is used to decodethe current block, a syntax element may be used to signal the interprediction mode.

For some currently used syntax structures of the inter prediction modeused for parsing the current block, refer to Table 1 where some syntaxesfor the inter prediction mode are listed. A syntax element in a syntaxstructure may be alternatively represented by other identifiers.

TABLE 1 Descriptor coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {if( cu_skip_flag[ x0 ] [ y0 ] = = 0 ) merge_flag[ x0 ][ y0 ] ae(v) if(merge_flag[ x0 ] [ y0 ]) { merge_data( x0, y0, cbWidth, cbHeight ) }else if ( CuPredMode[ x0 ][ y0 ] = = MODE_IBC ) { mvd_coding( x0, y0, 0,0 ) mvp_l0_flag[ x0 ][ y0 ] ae(v) if( sps_amvr_enabled_flag && ( MvdL0[x0 ][y0 ][ 0 ] != 0 | | MvdL0[ x0 ][y0 ][ 1 ] != 0 )) {amvr_precision_flag[ x0 ] [ y0 ] ae(v) } } else { if( tile_group_type == B ) inter_pred_idc[ x0 ] [ y0 ] ae(v) if( sps_affine_enabled_flag &&cbWidth >= 16 && cbHeight >= 16 ) { inter_affine_flag[ x0 ] [ y0 ] ae(v)if( sps_affine_type_flag && inter_affine_flag[ x0 ][ y0 ] )cu_affine_type_flag[ x0 ][ y0 ] ae(v) } if( inter_pred_idc[ x0 ] [ y0 ]= = PRED_BI && !inter_affine_flag[ x0 ] [ y0 ] && RefIdxSymL0 > −1 &&RefIdxSymLl > −1 ) sym_mvd_flag[ x0 ][ y0 ] ae(v) if( inter_pred_idc[ x0][ y0 ] != PRED_L1 ) { if( NumRefIdxActive[ 0 ] > 1 && !sym_mvd_flag[ x0][ y0 ] ) ref_idx_l0[ x0 ][ y0 ] ae(v) mvd_coding( x0, y0, 0, 0 ) if(MotionModelIdc[ x0 ][ y0 ] > 0 ) mvd_coding( x0, y0, 0, 1 )if(MotionModelIdc[ x0 ][ y0 ] > 1 ) mvd_coding( x0, y0, 0, 2 )mvp_l0_flag[ x0 ][ y0 ] ae(v) } else { MvdL0[ x0 ][ y0 ][ 0 ] = 0 MvdL0[x0 ][y0 ][ 1 ] = 0 } if( inter_pred_idc[ x0 ][ y0 ] != PRED_ L0 ) { if(NumRefIdxActive[ 1 ] > 1 && !sym_mvd_flag[ x0 ][ y0 ] ) ref_idx_l1[ x0][ y0 ] ae(v) if( mvd_l1_zero_flag && inter_pred_idc[ x0 ][ y0 ] = =PRED_BI ) { MvdL1[ x0 ][ y0 ][ 0 ] = 0 MvdL1[ x0 ][ y0 ][ 1 ] = 0MvdCpL1[ x0 ][ y0 ][ 0 ][ 0 ] = 0 MvdCpL1[ x0 ][ y0 ][ 0 ][ 1 ] = 0MvdCpL1[ x0 ][ y0 ][ 1 ][ 0 ] = 0 MvdCpL1[ x0 ][ y0 ][ 1 ][ 1 ] = 0MvdCpL1[ x0 ][ y0 ][ 2 ][ 0 ] = 0 MvdCpL1[ x0 ][ y0 ][ 2 ][ 1 ] = 0 }else { if( sym_1mvd_flag[ x0 ][ y0 ] ) { MvdL1[ x0 ][ y0 ][ 0 ] =−MvdL0[ x0 ][ y0 ][ 0 ] MvdL1[ x0 ][ y0 ][ 1 ] = −MvdL0[ x0 ][ y0 ][ 1 ]} else mvd_coding( x0, y0, 1, 0 ) if( MotionModelIdc[ x0 ][ y0 ] > 0 )mvd_coding( x0, y0, 1, 1 ) if(MotionModelIdc[ x0 ][ y0 ] > 1 )mvd_coding( x0, y0, 1, 2 ) mvp_l1_flag[ x0 ][ y0 ] ae(v) } } else {MvdL1[ x0 ][ y0 ][ 0 ] = 0 MvdL1[ x0 ][ y0 ][ 1 ] = 0 } ...... } }...... } }

In Table 1, inter_affine_flag[x0][y0] equal to 1 specifies that for thecurrent coding unit, when decoding a P or B tile group, affine modelbased motion compensation is used to generate the prediction samples ofthe current coding unit. inter_affine_flag[x0][y0] equal to 0 specifiesthat the coding unit is not predicted by affine model based motioncompensation. When inter_affine_flag[x0][y0] is not present, it isinferred to be equal to 0.

inter_pred_idc[x0][y0] specifies whether list0, list1, or bi-predictionis used for the current coding unit according to Table 2. The arrayindices x0, y0 specify the location (x0, y0) of the top-left luma sampleof the considered coding block relative to the top-left luma sample ofthe picture.

When inter_pred_idc[x0][y0] is not present, it is inferred to be equalto PRED_L0.

TABLE 2 Name of inter_pred_idc ( cbWidth + ( cbWidth + inter_pred_idccbHeight ) != 8 cbHeight ) = = 8 0 PRED_L0 PRED_L0 1 PRED_L1 PRED_L1 2PRED_BI n.a.

sps_affine_enabled_flag specifies whether affine model based motioncompensation can be used for inter prediction. Ifsps_affine_enabled_flag is equal to 0, the syntax shall be constrainedsuch that no affine model based motion compensation is used in the CVS,and inter_affine_flag and cu_affine_type_flag are not present in codingunit syntax of the CVS. Otherwise (sps_affine_enabled_flag is equal to1), affine model based motion compensation can be used in the CVS.

A syntax element inter_affine_flag[x0][y0] (oraffine_inter_flag[x0][y0]) may be used to indicate whether the affinemotion model-based AMVP mode is used for the current block when theslice in which the current block is located is a P-type slice or aB-type slice. When this syntax element does not appear in the bitstream,the syntax element is 0 by default. For example,inter_affine_flag[x0][y0]=1 indicates that the affine motion model-basedAMVP mode is used for the current block; and inter_affine_flag[x0][y0]=0indicates that the affine motion model-based AMVP mode is not used forthe current block, and a translational motion model-based AMVP mode maybe used. That is, inter_affine_flag[x0][y0] equal to 1 specifies thatfor the current coding unit, when decoding a P or B tile group, affinemodel based motion compensation is used to generate the predictionsamples of the current coding unit. inter_affine_flag[x0][y0] equal to 0specifies that the coding unit is not predicted by affine model basedmotion compensation. When inter_affine_flag[x0][y0] is not present, itis inferred to be equal to 0.

The syntax element cu_affine_type_flag[x0][y0] may be used to indicatewhether the 6-parameter affine motion model is used to perform motioncompensation for the current block when the slice in which the currentblock is located is a P-type slice or a B-type slice.cu_affine_type_flag[x0][y0]=0 indicates that the 6-parameter affinemotion model is not used to perform motion compensation for the currentblock, and only the 4-parameter affine motion model may be used toperform motion compensation; and cu_affine_type_flag[x0][y0]=1 indicatesthat the 6-parameter affine motion model is used to perform motioncompensation for the current block. That is, cu_affine_type_flag[x0][y0]equal to 1 specifies that for the current coding unit, when decoding a Por B tile group, 6-parameter affine model based motion compensation isused to generate the prediction samples of the current coding unit.cu_affine_type_flag[x0][y0] equal to 0 specifies that 4-parameter affinemodel based motion compensation is used to generate the predictionsamples of the current coding unit.

As shown in Table 3, MotionModelIdc[x0][y0]=1 indicates that the4-parameter affine motion model is used, MotionModelIdc[x0][y0]=2indicates that the 6-parameter affine motion model is used, andMotionModelIdc[x0][y0]=0 indicates that the translational motion modelis used.

TABLE 3 Motion model for motion compensation (motion model for motioncompensation) 0 Translational motion (translational motion) 14-parameter affine motion (4-parameter affine motion) 2 6-parameteraffine motion (6-parameter affine motion)

Variables MaxNumMergeCand and MaxAffineNumMrgCand are used to representa maximum list length, and indicate the maximum length of a constructedcandidate motion vector list. inter_pred_idc[x0][y0] is used to indicatea prediction direction. PRED_L1 is used to indicate backward prediction.num_ref_idx_l0 active_minus1 indicates the number of reference frames ina forward reference frame list, and ref_idx_l0[x0][y0] indicates theforward reference frame index value of the current block. mvd_coding(x0,y0, 0, 0) indicates the first motion vector difference.mvp_l0_flag[x0][y0] indicates a forward MVP candidate list index value.PRED_L0 indicates forward prediction. num_ref_idx_l1_active_minus1indicates the number of reference frames in a backward reference framelist. ref_idx_l1[x0][y0] indicates the backward reference frame indexvalue of the current block, and mvp 11 flag[x0][y0] indicates a backwardMVP candidate list index value.

In Table 1, ae(v) represents a syntax element encoded by usingcontext-based adaptive binary arithmetic coding (cabac).

FIG. 9A is a flowchart showing a process of a decoding method accordingto an embodiment of this application. The process may be performed by aninter prediction unit 344 of a video decoder 30. The process isdescribed as a series of steps or operations. It should be understoodthat the process may be performed in various orders and/or concurrently,and is not limited to the execution order shown in FIG. 9A. It isassumed that a video decoder is employed to decode a video data streamhaving a plurality of video frames by using a process which includes theinter prediction process shown in FIG. 9A.

Step 601: Parse a bitstream based on a syntax structure shown in Table1, to determine the inter prediction mode of the current block.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based AMVP mode, perform step 602 a.

For example, syntax elements merge_flag=0 and inter_affine_flag=1indicate that the inter prediction mode of the current block is theaffine motion model-based AMVP mode.

If it is determined that the inter prediction mode of the current blockis an affine motion model-based merge mode, perform step 602 b.

For example, syntax elements merge_flag=1 and inter_affine_flag=1indicate that the inter prediction mode of the current block is theaffine motion model-based merge mode.

Step 602 a: Construct a candidate motion vector list corresponding tothe affine motion model-based AMVP mode.

One or more control point motion vectors candidates (e.g. one or moreX-tuple candidates) of the current block can be derived by using aninherited control point motion vector prediction method and/or aconstructed control point motion vector prediction method. These controlpoint motion vectors candidates can be added to the candidate motionvector list.

The candidate motion vector list may include a 2-tuple list (a4-parameter affine motion model is used for the current coding block) ora 3-tuple list. The 2-tuple list includes one or more 2-tuples used forconstructing a 4-parameter affine motion model. The 3-tuple listincludes one or more 3-tuples used for constructing a 6-parameter affinemotion model. It can be understood that each 2-tuple candidate includestwo candidate control point motion vectors of the current block.

Optionally, the candidate motion vector 2-tuple/3-tuple list is prunedand sorted according to a particular rule, and may be truncated orpadded to include a particular quantity of 2-tuples or 3-tuples.

A1: A process of constructing the candidate motion vector list by usingthe inherited control point motion vector prediction method isdescribed.

FIG. 7 is used as an example. In this example, blocks at neighboringlocations around the current block are traversed in an order ofA1->B1->B0->A0->B2 to find an affine coded block containing a block at aneighboring location of the current block, and to obtain control pointmotion information of the affine coded block. The control point motioninformation of the affine coded block can be utilized to construct amotion model to derive candidate control point motion information of thecurrent block. Details of this process are provided above in thedescriptions of the inherited control point motion vector predictionmethod in 3.

In one example, the affine motion model used for the current block is a4-parameter affine motion model (that is, MotionModelIdc=1). In thisexample, if the 4-parameter affine motion model is used for aneighboring affine decoding block, motion vectors of two control pointsof the affine decoding block are obtained: the motion vector (vx4, vy4)of the top-left control point (x4, y4), and the motion vector (vx5, vy5)of the top-right control point (x5, y5). The affine decoding block is anaffine coded block predicted in an encoding phase by using an affinemotion model.

The motion vectors of the two control points, namely, the top-left andtop-right control points, of the current block are derived according to4-parameter affine motion model formulas (6) and (7), respectively, byusing a 4-parameter affine motion model including two control points ofthe neighboring affine decoding block.

If a 6-parameter affine motion model is used for the neighboring affinedecoding block, motion vectors of three control points of theneighboring affine decoding block are obtained, for example, the motionvector (vx4, vy4) of the top-left control point (x4, y4), the motionvector (vx5, vy5) of the top-right control point (x5, y5), and themotion vector (vx6, vy6) of the bottom-left control point (x6, y6) inFIG. 7.

The motion vectors of the two control points, namely, the top-left andtop-right control points, of the current block are derived according to6-parameter affine motion model formulas (8) and (9), respectively, byusing the 6-parameter affine motion model including three control pointsof the neighboring affine decoding block.

In another example, the affine motion model used for the currentdecoding block is a 6-parameter affine motion model (that is,MotionModelIdc=2).

If the affine motion model used for the neighboring affine decodingblock is the 6-parameter affine motion model, motion vectors of threecontrol points of the neighboring affine decoding block are obtained,for example, the motion vector (vx4, vy4) of the top-left control point(x4, y4), the motion vector (vx5, vy5) of the top-right control point(x5, y6), and the motion vector (vx6, vy6) of the bottom-left controlpoint (x6, y6) in FIG. 7.

The motion vectors of the three control points, namely, the top-left,top-right, and bottom-left control points, of the current block arederived according to formulas (8), (9), and (10) corresponding to the6-parameter affine motion model, respectively, by using the 6-parameteraffine motion model including three control points of the neighboringaffine decoding block.

If the affine motion model used for the neighboring affine decodingblock is a 4-parameter affine motion model, motion vectors of twocontrol points of the neighboring affine decoding block can be obtained.These motion vectors can be, for example, the motion vector (vx4, vy4)of the top-left control point (x4, y4) and the motion vector (vx5, vy5)of the top-right control point (x5, y5).

The motion vectors of three control points, such as, the top-left,top-right, and bottom-left control points, of the current block can bederived. For example, these motion vectors can be derived according to4-parameter affine motion model formulas (6) and (7) by using the4-parameter affine motion model represented based on two control pointsof the neighboring affine decoding block.

It should be noted that other motion models, candidate locations, andsearch orders can also be employed herein. Further, methods forrepresenting the motion models of neighboring and current coding blocksbased on other control points can also be used.

A2: A process of constructing a candidate motion vector list by usingthe constructed control point motion vector prediction method isdescribed.

In one example, the affine motion model used for a current decodingblock is a 4-parameter affine motion model (that is, MotionModelIdc=1).In this example, motion vectors of the top-left sample and the top-rightsample of the current coding block are determined based on motioninformation of a neighboring encoded block of the current coding block.Specifically, the candidate motion vector list may be constructed byusing the constructed control point motion vector prediction method 1described above with respect to item 4 or the constructed control pointmotion vector prediction method 2 described above with respect to item5.

In another example, the affine motion model used for the currentdecoding block is a 6-parameter affine motion model (that is,MotionModelIdc=2). In this example, motion vectors of the top-leftsample, the top-right sample, and the bottom-left sample of the currentcoding block are determined by using motion information of a neighboringencoded block of the current coding block. Specifically, the candidatemotion vector list may be constructed by using the constructed controlpoint motion vector prediction method 1 described above with respect toitem 4 or the constructed control point motion vector prediction method2 described above with respect to item 5.

It should be noted that other combinations of control point motioninformation can also be employed.

Step 603 a: Parse the bitstream and determine optimal control pointmotion vector predictors (i.e. an optimal multiple-tuple candidate).

B1: If an affine motion model used for the current decoding block is a4-parameter affine motion model (MotionModelIdc=1), an index number isparsed from the bitstream, and optimal motion vector predictors of twocontrol points are determined from the candidate motion vector listbased on the index number.

For example, the index number is mvp_l0_flag or mvp_l1_flag.

B2: If an affine motion model used for the current decoding block is a6-parameter affine motion model (MotionModelIdc=2), an index number isparsed from the bitstream, and optimal motion vector predictors of threecontrol points are determined from the candidate motion vector listbased on the index number.

Step 604 a: Parse the bitstream and determine control point motionvectors.

C1: If an affine motion model used for the current decoding block is a4-parameter affine motion model (MotionModelIdc=1), motion vectordifferences of two control points of the current block are respectivelyobtained by decoding the bitstream. The motion vector values of the twocontrol points are then obtained based on the motion vector differencesand the corresponding motion vector predictors of the control points.Using forward prediction as an example, motion vector differences of twocontrol points are mvd_coding(x0, y0, 0, 0) and mvd_coding(x0, y0, 0,1), respectively.

For example, motion vector differences of the top-left control point andthe top-right control point are obtained by decoding the bitstream, andare added to their respective motion vector predictors, to obtain motionvectors of the top-left control point and the top-right control point ofthe current block.

C2: An affine motion model used for a current decoding block is a6-parameter affine motion model (MotionModelIdc=2).

Motion vector differences of three control points of the current blockare obtained by decoding the bitstream. Motion vector values of thesecontrol points are obtained based on motion vector differences andrespective motion vector predictors of the control points. Using forwardprediction (i.e. list 0) as an example, motion vector differences ofthree control points are mvd_coding(x0, y0, 0, 0), mvd_coding(x0, y0, 0,1), and mvd_coding(x0, y0, 0, 2), respectively.

For example, motion vector differences of the top-left control point,the top-right control point, and the bottom-left control point areobtained by decoding the bitstream. These motion vector differences areadded to their respective motion vector predictors to obtain motionvectors of the top-left control point, the top-right control point, andthe bottom-left control point of the current block.

Step 605 a: Obtain a motion vector of each sub-block in the currentblock based on control point motion information and an affine motionmodel used for the current decoding block.

A sub-block in the current affine decoding block may be equivalent toone motion compensation unit, and the width and the height of thesub-block are less than the width and the height of the current block.Motion information of a sample at a preset location in a sub-block ormotion compensation unit may be used to represent motion information ofall samples in sub-block or the motion compensation unit. Assuming thatthe size of the motion compensation unit is MxN, the sample at thepreset location may be a center sample (M/2, N/2), a top-left sample (0,0), a top-right sample (M−1, 0), or a sample at another location in themotion compensation unit. The following description uses the centersample of the motion compensation unit as an example for description.Referring to FIG. 9C, V0 represents a motion vector of the top-leftcontrol point, and V1 represents a motion vector of the top-rightcontrol point. Each small box represents one motion compensation unit.

Coordinates of a center sample of a motion compensation unit relative tothe top-left sample in a current affine decoding block are calculatedaccording to formula (25). In formula (25), i indicates the i^(th)motion compensation unit in the horizontal direction (left to right), jindicates the j^(th) motion compensation unit in the vertical direction(top to bottom), and (x_((i,j))), y_((i,j))) represents the coordinatesof the center sample of the (i, j)^(th) motion compensation unitrelative to the top-left control point sample in the current affinedecoding block.

If the affine motion model used for the current affine decoding block isa 6-parameter affine motion model, (x_((i,j)), y_((i,j))) is substitutedinto the 6-parameter affine motion model formula (26) to obtain themotion vector of the center sample of each motion compensation unit(vx_((i,j)), vy_((i,j))). As discussed above, the motion vector of thecenter pixel of a motion compensation unit is used as the motion vectorsof all samples in the motion compensation unit.

If the affine motion model used for the current affine decoding block isa 4-affine motion model, (x_((i,j)), y_((i,j))) is substituted into the4-parameter affine motion model formula (27), to obtain the motionvector of a center sample of each motion compensation unit(vx_((i,j)),vy_((i,j))) which is used as the motion vectors of all samples in themotion compensation unit.

$\begin{matrix}\left\{ \begin{matrix}{{x_{({i,j})} = {{M \times i} + \frac{M}{2}}},{i = 0},{1\mspace{14mu}\ldots}} \\{{y_{({i,j})} = {{N \times j} + \frac{N}{2}}},{j = 0},{1\mspace{14mu}\ldots}}\end{matrix} \right. & (25) \\\left\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} + {\frac{{vx}_{2} - {vy}_{0}}{H}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vy}_{2} - {vx}_{0}}{H}y} + {vy}_{0}}}\end{matrix} \right. & (26) \\\left\{ \begin{matrix}{{vx} = {{\frac{{vx}_{1} - {vx}_{0}}{W}x} - {\frac{{vy}_{1} - {vy}_{0}}{W}y} + {vx}_{0}}} \\{{vy} = {{\frac{{vy}_{1} - {vy}_{0}}{W}x} + {\frac{{vx}_{1} - {vx}_{0}}{W}y} + {vy}_{0}}}\end{matrix} \right. & (27)\end{matrix}$

Step 606 a: Perform motion compensation for each sub-block based on thedetermined motion vector of the sub-block, to obtain prediction samplevalues of the sub-block.

As discussed above, if it is determined at step 601 that the interprediction mode of the current block is an affine motion model-basedmerge (merge) mode, step 602 b is performed.

Step 602 b: Construct a motion information candidate list correspondingto the affine motion model-based merge mode.

Specifically, the motion information candidate list corresponding to theaffine motion model-based merge mode may be constructed by using aninherited control point motion vector prediction method and/or aconstructed control point motion vector prediction method.

Optionally, the motion information candidate list is pruned and sortedaccording to a particular rule, and may be truncated or padded tocontain a particular quantity of motion information.

D1: A process of constructing the candidate motion vector list by usingthe inherited control point motion vector prediction method isdescribed.

Candidate control point motion information of the current block isderived by using the inherited control point motion vector predictionmethod, and is added to the motion information candidate list.

In the example shown in FIG. 8A, blocks at neighboring locations aroundthe current block are traversed according to the order ofA1->B1->B0->A0->B2 to find an affine coded block in which a neighboringblock is located, and obtain control point motion information of theaffine coded block. Further, candidate control point motion informationof the current block is derived by using the motion model of the currentblock.

If the candidate motion vector list is empty, the candidate controlpoint motion information obtained above is added to the candidate list.Otherwise, motion information in the candidate motion vector list istraversed sequentially, to check whether motion information that is thesame as the candidate control point motion information exists in thecandidate motion vector list. If no motion information that is the sameas the candidate control point motion information exists in thecandidate motion vector list, the candidate control point motioninformation is added to the candidate motion vector list.

Determining whether two pieces of candidate motion information are thesame can be performed by determining whether forward (list 0) andbackward (list 1) reference frames of the candidate motion informationand horizontal and vertical components of each forward and backwardmotion vector are the same. The two pieces of candidate motioninformation are considered as being different only when all theseelements are different.

If a quantity of pieces of motion information in the candidate motionvector list reaches a maximum list length MaxAffineNumMrgCand(MaxAffineNumMrgCand is a positive integer such as 1, 2, 3, 4, or 5, and5 is used as an example in the following description), construction ofthe candidate list is completed. Otherwise, a next neighboring block istraversed.

D2: The candidate control point motion information of the current blockis derived by using the constructed control point motion vectorprediction method, and is added to the motion information candidatelist. FIG. 9B shows an example of a flowchart for the constructedcontrol point motion vectors prediction method.

Step 601 c: Obtain motion information of control points of the currentblock. This step is similar to step 501 in “5. Constructed control pointmotion vector prediction method 2”. Details are not repeated herein.

Step 602 c: Combine the motion information of the control points, toobtain constructed control point motion information. This step issimilar to step 501 in FIG. 8B and the details of this step are notdescribed herein again.

Step 603 c: Add the constructed control point motion information to thecandidate motion vector list.

If the length of the candidate list is less than a maximum list lengthMaxAffineNumMrgCand, the combinations of motion information of controlpoints are traversed in a preset order, and a resulting validcombination is used as the candidate control point motion information.In this case, if the candidate motion vector list is empty, thecandidate control point motion information is added to the candidatemotion vector list. Otherwise, motion information in the candidatemotion vector list is traversed sequentially, to check whether motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list. If no motioninformation that is the same as the candidate control point motioninformation exists in the candidate motion vector list, the candidatecontrol point motion information is added to the candidate motion vectorlist.

For example, a preset order is as follows: Affine (CP1, CP2,CP3)->Affine (CP1, CP2, CP4)->Affine (CP1, CP3, CP4)->Affine (CP2, CP3,CP4)->Affine (CP1, CP2)->Affine (CP1, CP3)->Affine (CP2, CP3)->Affine(CP1, CP4)->Affine (CP2, CP4)->Affine (CP3, CP4). There are 10combinations in total.

If control point motion information corresponding to a combination isunavailable, this combination is deemed unavailable. If a combination isavailable, a reference frame index of the combination is determined. Ina case of two control points, the minimum reference frame index isselected as the reference frame index of the combination. In a case ofmore than two control points, a reference frame index with a maximumpresence frequency is selected as the reference frame index of thecombination. If a plurality of reference frame indexes have the samepresence frequency, the minimum reference frame index is selected as thereference frame index. The control point motion vector is furtherscaled. If motion information of all control points after scaling isconsistent, the combination is invalid.

Optionally, in this embodiment of this application, the candidate motionvector list may be padded. For example, after the foregoing traversalprocess, if the length of the candidate motion vector list is less thanthe maximum list length MaxAffineNumMrgCand, the candidate motion vectorlist may be padded until the list length is equal toMaxAffineNumMrgCand.

The padding may be performed by using a zero motion vector paddingmethod, or by combining (e.g., weighted averaging) existing candidatemotion information in the existing list. It should be noted that othermethods for padding the candidate motion vector list are also applicableto this application.

Step 603 b: Parse the bitstream and determine optimal control pointmotion information.

An index number is parsed, and the optimal control point motioninformation is determined from the candidate motion vector list based onthe index number.

Step 604 b: Obtain a motion vector of each sub-block in the currentblock based on optimal control point motion information and an affinemotion model used for the current decoding block.

This step is similar to step 605 a.

Step 605 b: Perform motion compensation for each sub-block based on thedetermined motion vector of the sub-block, to obtain prediction samplevalues of the sub-block.

As described above, after the motion vector of each sub-block isobtained in step 605 a and 604 b, motion compensation for the sub-blockis performed in step 606 a and 605 b, respectively. That is, the detailsof performing subblock-based affine motion compensation for a currentsub-block of the affine coded block, to obtain prediction sample valuesof the current sub-block of the affine coded block is described above.In the conventional design, the size of the sub-block is set to 4×4,that is, motion compensation is performed for each 4×4 unit by using arespective/different motion vector. Generally, a smaller size of asub-block leads to higher motion compensation calculation complexity anda better prediction effect. To take both the motion compensationcalculation complexity and the prediction accuracy into consideration,after the subblock-level motion compensation, a process for predictionsignal refinement with optical flow (PROF) is provided. example steps ofthe process are as follows:

(1) After a motion vector of each sub-block is obtained by using steps605 a and 604 b, and then perform motion compensation for the sub-blockby using steps 606 a and 605 b, to obtain a prediction signal I(i, j) ofthe sub-block. It can be noted that step (1) is not included in the PROFprocess.

(2) Calculate a horizontal gradient value g_(x)(i,j) and a verticalgradient value g_(y)(i,j) of the prediction signal of the sub-block,where a calculation method is as follows:

g _(x)(i,j)=I(i+1,j)−I(i−1,j)

g _(y)(i,j)=I(i,j+1)−I(i,j−1)

It can be learned from the formulas that, to obtain the gradient valuesfor a 4×4 block (4×4 gradient values), a 6×6 prediction signal window900 is required, as shown in FIG. 9D.

This can be implemented by using the following different methods:

a) After a prediction matrix of a sub-block is obtained based on motioninformation (for example, a motion vector) of the sub-block, obtain ahorizontal gradient matrix and a vertical gradient matrix of thesub-block. In other words, the (M+2)*(N+2) prediction block is obtainedthrough interpolation based on the motion vector of the M×N sub-block.For example, interpolation is directly performed based on the motionvector of the sub-block, to obtain a 6×6 prediction signal, andcalculate a 4×4 gradient value (i.e. 4×4 gradient matrix).

b) Perform interpolation based on the motion vector of the sub-block, toobtain a 4×4 prediction signal (i.e. the first prediction matrix), andthen perform edge extension on the prediction signal, to obtain a 6×6prediction signal (i.e. the second prediction matrix) and calculate a4×4 gradient value (i.e. 4×4 gradient matrix).

c) Perform interpolation based on the motion vector of each sub-block,to obtain each 4×4 prediction signal (i.e. the first prediction matrix),and obtain a w*h prediction signal through combination. Then, performedge extension on the w*h prediction signal, to obtain a (w+2)*(h+2)prediction signal, and calculate a w*h gradient value (i.e. w*h gradientmatrix), to obtain each 4×4 gradient value (i.e. 4×4 gradient matrix).

It should be noted that, obtaining an (M+2)*(N+2) prediction blockdirectly through interpolation based on the motion vector of the M×Nsub-block includes the following implementations:

a1) for a surrounding region (white samples in FIG. 13), an integersample of a top-left sample of a location to which the motion vectorpoints is obtained. For an inner region (gray samples in FIG. 13), asample of a location to which the motion vector points is obtained. Ifthe sample is a fractional sample, the sample is obtained throughinterpolation by using an interpolation filter.

As shown in FIGS. 14, A, B, C, and D are integer samples, a motionvector of an M×N sub-block is of 1/16 sample precision, dx/16 is ahorizontal distance between a fractional sample and the integer sampleof a top-left sample, and dy/16 is a vertical distance between thefractional sample and the integer sample of the top-left sample. For thesurrounding region, a sample value of A is used as the prediction samplevalue of the sample location. For an inner region, the prediction samplevalue of the sample location is obtained through interpolation by usingan interpolation filter.

a2) for a surrounding region (white samples in FIG. 13), an integersample nearest to a location to which the motion vector points isobtained. For an inner region (gray samples in FIG. 13), a sample of alocation to which the motion vector points is obtained. If the sample isa fractional sample, the sample is obtained through interpolation byusing an interpolation filter.

As shown in FIG. 14, for a surrounding region, an integer sample nearestto a location to which the motion vector points is selected based on dxand dy.

a3) For both a surrounding region and an inner region, the sample of alocation to which the motion vector points is obtained. If the sample isa fractional sample, the sample is obtained through interpolation byusing an interpolation filter.

It should be understood that a), b), and c) are three differentimplementations.

(3) Calculate a delta prediction value, where a calculation method is asfollows:

ΔI(i,j)=g _(x)(i,j)*Δv _(x)(i,j)+g _(y)(i,j)*Δv _(y)(i,j)

(i, j) represents a current sample of the sub-block, Δ_(v) (i, j) is adifference (as shown in FIG. 10) between a motion vector of the currentsample of the current sub-block and a motion vector of a center sampleof the sub-block, and may be calculated according to the foregoingformula, and Δv_(x)(i, j) and Δv_(y)(i, j) are a horizontal offset valueand a vertical offset value of a difference between a motion vector ofthe current sample of the current sub-block and a motion vector of acenter sample of the sub-block. Alternatively, in a simplified method, amotion vector difference between a motion vector of each 2×2 sampleblock to which the current sample belong and a motion vector of a centersample of the sub-block may be calculated. In comparison, Δv (i, j): amotion vector difference needs to be calculated for each pixel or sample(for example, calculation needs to be performed 16 times for a 4×4sub-block). However, in the simplified method, a motion vectordifference is calculated for each 2×2 sub-block (for example,calculation is performed four times for the 4×4 sub-block). It should benoted that the sub-block herein may be a 4×4 sub-block or an m×nsub-block. For example, m herein is greater than or equal to 4, or nherein is greater than or equal to 4.

$\left\{ {\begin{matrix}{{{\Delta v}_{x}\left( {x,y} \right)} = {{c*x} + {d*y}}} \\{{{\Delta v}_{y}\left( {x,y} \right)} = {{e*x} + {f*y}}}\end{matrix}\quad} \right.$

For a 4-parameter affine model:

$\left\{ {\begin{matrix}{c = {f = \frac{v_{1x} - v_{0x}}{w}}} \\{e = {{- d} = \frac{v_{1y} - v_{0y}}{w}}}\end{matrix}\quad} \right.$

For a 6-parameter affine model:

$\left\{ {\begin{matrix}{c = \frac{v_{1x} - v_{0x}}{w}} \\{d = \frac{v_{2x} - v_{0x}}{h}} \\{e = \frac{v_{1y} - v_{0y}}{w}} \\{f = \frac{v_{2y} - v_{0y}}{h}}\end{matrix}\quad} \right.$

where (v_(0x), v_(0y)), (v_(1x), v_(1y)) and (v_(2x), v_(2y)) are motionvectors of top-left, top-right, and bottom-left control points, and wand h are a width and a height of an affine coded block (CU).

(4) Perform prediction refinement:

I′(i,j)=I(i,j)+ΔI(i,j)

where I(i, j) is a prediction value of a sample (i, j) of the sub-block(i.e. prediction sample value at location (i,j) in the subblock), ΔI(i,j) is a delta prediction value of the sample (i, j) of the sub-block,and I′(i, j) is a refined prediction sample value of the sample (i, j)of the sub-block.

The prediction refinement with optical flow (PROF) process isconditionally performed to refine the sub-block based affine motioncompensated prediction with optical flow according to embodiment of thepresent disclosure is described as follows.

Embodiment 1

A method for obtaining delta prediction values of a sub-block (which isspecifically a delta prediction value of each sample of the sub-block)with optical flow may be applied to a unidirectional affine coded block,or may be applied to a bidirectional affine coded block. If the methodis applied to a bidirectional affine prediction block, steps (1) to (4)described above need to be performed twice, resulting in relatively highcomputational complexity. To reduce complexity of the method, thepresent disclosure provides a constraint for applying PROF. To bespecific, prediction sample values are refined by using this method onlywhen the affine coded block is a unidirectional affine coded block.

At the decoder side, a syntax element obtained by parsing a bitstreamindicates uni- or bi-prediction. This syntax element can be used todetermine whether the affine coded block is a unidirectional affinecoded block.

At the encoder side, structures of B and P frames are determined bydifferent user cases, and whether uni- or bi-prediction is used in the Bframe is determined by RDO. In other words, for the B frame, the encoderside may determine, based on an RDO cost, whether uni- or bi-predictionis used for the current affine picture block. For example, the encoderside attempts to select a mechanism among the forward prediction,backward prediction and bidirectional prediction that minimize the RDO.

Embodiment 2

To reduce the complexity of the prediction signal refinement withoptical flow, the method for obtaining a prediction offset value of asub-block with optical flow may be used only when the size of thesub-block is relatively large. For example, the sub-block size of aunidirectional affine coded block may be set to 4×4, and the sub-blocksize of a bidirectional affine coded block may be set to 8×8, 8×4, or4×8. In this example, the method is used only when the sub-block size isgreater than 4×4. For another example, the sub-block size may beadaptively selected based on information such as motion vectors ofcontrol points of the affine coded block, the width and height of theaffine coded block, and the like. The method is used only when thesub-block size is greater than 4×4.

In addition, in step (2), the methods a) and b) can both ensure thatprediction of each 4×4 sub-block of the affine coded block has nodependency and can be performed concurrently. However, the method a)increases complexity of interpolation calculation. Although the methodb) does not increase complexity, the gradient value of the boundary isobtained through calculation by using an extended sample, and theaccuracy is not high. The method c) can improve accuracy of gradientcalculation, but each 4×4 sub-block has dependency, that is, refinementbased on optical flow can be performed only when interpolation of anentire CU is completed.

As shown in FIG. 9E, to take both concurrency and accuracy of gradientcalculation into consideration, the present disclosure proposes gradientvalue calculation based on a granularity of 16×16. Given size_w=min(w,16), and size_h=min(h, 16), for each size_w*size _h in the affine codedblock, the predictor(prediction sample values) of each 4×4 sub-block inthe affine coded block is calculated, and the size_w*size_h predictionsignal is obtained through combination. Then, edge extension isperformed on the size_w*size_h prediction signal (for example, extendedtwo samples outward, such as by padding), to obtain a(size_w+2)*(size_h+2) prediction signal. The size_w*size_h gradientvalue is calculated, to obtain each 4×4 gradient value. It should beunderstood that a quantity of samples extended outward in thisapplication is not limited to two samples, and is related to gradientcalculation. If the gradient resolution is 3-tap, two samples areextended outward. In other words, this is related to a filter forgradient calculation. Assuming that a quantity of taps of the filter isT, an added region or a surrounding region supported is T/2(divisible)*2.

FIG. 11A shows a method for prediction refinement with optical flow(PROF) for an affine coded block according to one embodiment, the methodcan be performed by a coding apparatus (such as a decoding apparatus ora decoder). The method includes the following steps:

S1101. determine that a plurality of optical flow decision conditionsare fulfilled;

Here the optical flow decision conditions can also be called asconditions allowing for the application of PROF. If all of the opticalflow decision conditions are satisfied, the PROF is applied for thecurrent sub-block of the affine coded block. Examples of the opticalflow decision conditions are described below. In some examples, theoptical flow decision conditions may be replaced with or rephrased asconstraint conditions for applying PROF. If a constraint condition forapplying PROF is satisfied, then the PROF is not applied to the currentsub-block of the affine coded block. In those examples, the step S1101will be changed to determining that none of a plurality of theconstraint conditions for applying PROF are fulfilled.

S1102. performing a PROF process for a current sub-block of the affinecoded block, to obtain refined prediction sample values of the currentsub-block of the affine coded block, where the plurality of optical flowdecision conditions are all fulfilled for the affine coded block. Herethe refined prediction sample values of the current sub-block can beunderstood as final prediction sample values of the current sub-blockafter the prediction refinement is added.

In step S1102, perform optical flow (prediction refinement with opticalflow, PROF) processing for one or more sub-blocks (for example, acurrent sub-block or each sub-block) in the current affine pictureblock, to obtain a delta prediction value (for example, A/(i,j)) of theone or more sub-blocks (for example, the current sub-block or eachsub-block) in the current affine picture block.

Step S1102 involves obtaining a refined prediction sample value (forexample, a prediction signal I′(i, j)) of the sub-block based on thedelta prediction value (for example, ΔI(i, j)) of the sub-block and aprediction sample value (for example, a prediction signal I(i, j)) ofthe sub-block.

Specifically, step S1102 involves obtaining a refined predictor (forexample, a prediction signal I′(i, j)) of a current sample in thesub-block based on a delta prediction value (for example, ΔI(i, j)) ofthe current sample in the sub-block and a predictor (for example, aprediction signal I(i,j)) of the current sample in the sub-block.

In a possible design, the plurality of optical flow decision conditionsinclude one or more of the following:

(a) Indication information (for example, sps_prof_enabled_flag orsps_bdof_enabled_flag) obtained through parsing or derivation indicatesthat PROF is enabled for a current sequence, picture, slice, or tilegroup. For example, sps_prof_enabled_flag or sps_bdof_enabled_flag=1. Itcan be understood that if constraint conditions for applying PROF areused in S1101 instead of the optical flow decision conditions, thiscondition can be converted to a constraint condition for applying PROFas: (a) Indication information indicates that PROF is disabled for acurrent sequence, picture, slice, or tile group. For example,sps_prof_disabled_flag or sps_bdof_disabled_flag=1.

Indication information obtained by parsing a parameter set such as SPS,PPS, a slice header, or a tile group header indicates whether PROF isenabled for the current sequence, picture, slice, or tile group.

Specifically, sps_prof_enabled_flag may be used for control, and syntaxand semantics of sps_prof_enabled_flag are as follows:

Descriptor seq_parameter_set_rbsp( ) { ... sps_affine_enabled_flag u(1)if( sps_affine_enabled_flag ) { sps_affine_type_flag u(1)sps_prof_enabled_flag u(1) } ...

sps_prof_enabled_flag equal to 0 specifies that the predictionrefinement optical flow for affine based motion compensation isdisabled. sps_prof_enabled_flag equal to 1 specifies that the predictionrefinement optical flow for affine based motion compensation is enabled.

Alternatively, sps_bdof_enabled_flag is reused for control.

It should be understood that, in this embodiment, another condition isfurther derived on the premise that the foregoing condition is met (forexample, a main switch determines to enable PROF). In other words, ifPROF is enabled for the current sequence, picture, slice, or tile group,it is further determined whether the current affine picture block meetsanother optical flow decision condition described below. If PROF is notenabled for the current sequence, picture, slice, or tile group, it isunnecessary to determine whether the current affine picture block meetsanother optical flow decision condition provided in the following.

(b) Derived indication information (for example, the variablefallbackModeTriggered) indicates that the current affine coded block isto be partitioned. For example, fallbackModeTriggered=0. It can beunderstood that if constraint conditions for applying PROF are used inS1101, instead of the optical flow decision conditions, condition (b)can be converted to a constraint condition for applying PROF as: (b)derived indication information indicates that the current affine codedblock is no partitioned. For example, fallbackModeTriggered=1.

A variable fallbackModeTriggered is derived based on an affineparameter, and whether to use PROF depends on fallbackModeTriggered.When fallbackModeTriggered is 1, it indicates that the current affinecoded block is not to be partitioned. When fallbackModeTriggered is 0,it indicates that the affine coded block is to be partitioned (forexample, the affine coded block is partitioned into sub-blocks, forexample, 4×4 sub-blocks). PROF is to be used when the current affinecoded block is to be partitioned.

Specifically, the variable fallbackModeTriggered may be derived by usingthe following process:

The variable fallbackModeTriggered is initially set to 1, and is furtherderived as follows:

-   -   The variables bxWX₄, bxHX₄, bxWX_(h), bxHX_(h), bxWXvand        bxHX_(v) are derived as follows:

maxW₄=Max(0,Max(4*(2048+dHorX),Max(4*dHorY,4*(2048+dHorX)+4*dHorY)))  (8-775)

minW₄=Min(0,Min(4*(2048+dHorX),Min(4*dHorY,4*(2048+dHorX)+4*dHorY)))  (8-775)

maxH₄=Max(0,Max(4*dVerX,Max(4*(2048+dVerY),4*dVerX+4*(2048+dVerY))))  (8-775)

minH₄=Min(0,Min(4*dVerX,Min(4*(2048+dVerY),4*dVerX+4*(2048+dVerY))))  (8-775)

bxWX ₄=((maxW ₄−minW ₄)>>11)+9  (8-775)

bxHX ₄=((maxH ₄−minH ₄)>>11)+9  (8-775)

bxWX _(h)=((Max(0,4*(2048+dHorX))−Min(0,4*(2048+dHorX)))>>11)+9  (8-775)

bxHX _(h)=((Max(0,4*dVerX)−Min(0,4*dVerX))>>11)+9  (8-775)

bxWX _(v)=((Max(0,4*dVerY)−Min(0,4*dVerY))>>11)+9  (8-775)

bxHX _(v)=((Max(0,4*(2048+dHorY))−Min(0,4*(2048+dHorY)))>>11)+9  (8-775)

-   -   If inter_pred_idc[xCb][yCb] is equal to PRED_B1 and bxWX₄*bxHX₄        is less than or equal to 225, fallbackModeTriggered is set equal        to 0.    -   Otherwise, if both bxWX_(h)*bxHX_(h) is less than or equal to        165 and bxWX_(v)*bxHX_(v) is less than or equal to 165,        fallbackModeTriggered is set equal to 0.

(c) The current affine picture block is a uni-prediction affine pictureblock.

(d) The size of the sub-block in the affine picture block is greaterthan N×N, where N=4.

(e) The current affine picture block is a uni-prediction affine pictureblock and the size of the sub-block in the affine picture block is equalto N×N, where N=4.

(f) The current affine picture block is a bi-prediction affine pictureblock and the size of the sub-block in the affine picture block isgreater than N×N, where N=4.

The current affine picture block is the current affine encoding block,and that the current affine picture block is a uni-prediction affinepicture block is determined by using the following method:

At encoder side, it is determined, based on a rate-distortion criterionRDO, that uni-prediction is used for the current affine picture block.

The current affine picture block is the current affine decoding block,and that the current affine picture block is a uni-prediction affinepicture block is determined by using the following method:

at decoder side, in an AMVP mode, prediction direction indicationinformation is used to indicate a uni-prediction direction (for example,only forward prediction or only backward prediction), and the predictiondirection indication information is obtained by parsing a bitstream orthrough derivation; or

at decoder side, in a merge mode, candidate motion informationcorresponding to a candidate index in a candidate list includes firstmotion information corresponding to a first reference frame list, orcandidate motion information corresponding to a candidate index in acandidate list includes second motion information corresponding to asecond reference frame list.

In a possible design, the prediction direction indication informationincludes a syntax element inter_pred_idc[x0][y0], where:

inter_pred_idc[x0][y0]=PRED_L0, used to indicate forward prediction;

inter_pred_idc[x0][y0]=PRED_L1, used to indicate backward prediction; or

the prediction direction indication information includes predFlagL0and/or predFlagL1, where:

predFlagL0=1, and predFlagL1=0, used to indicate forward prediction;

predFlagL1=1, and predFlagL0=0, used to indicate backward prediction.

It should be noted that the optical flow decision conditions (orconstraint conditions for applying PROF) are not limited to the aboveexamples, and additional or different optical flow decision conditions(or constraint conditions for applying PROF) may be set based ondifferent application scenarios. For example, the above conditions (c)to (f) may be replaced with other conditions, such as an optical flowdecision condition: PROF may be applied for an affine coded block if allcontrol point MVs of the affine coded block are different from eachother or a constraint condition for applying PROF: PROF is not beapplied for an affine coded block if all control point MVs of the affinecoded block are the same. Such as an optical flow decision condition:PROF may be applied for an affine coded block if the resolution of thecurrent picture and the resolution of reference picture of the affinecoded block are the same, e.g. RprConstraintsActive[X][refIdxLX] isequal to 0 or a constraint condition for applying PROF: PROF is not beapplied for an affine coded block if the resolution of the currentpicture and the resolution of reference picture of the affine codedblock are different from each other, e.g.RprConstraintsActive[X][refldxLX] is equal to 1.

In a possible design, in step S1102, the performing optical flow(prediction refinement with optical flow, PROF) processing for one ormore sub-blocks (for example, each sub-block or a current sub-block) inthe current affine picture block, to obtain a delta prediction value(for example, ΔI(i, j)) of the one or more sub-blocks (for example, eachsub-block or the current sub-block) in the current affine picture blockmay include the following steps:

Step1. Obtain a second prediction matrix based on motion information(for example, a motion vector) of a current sub-block in the currentaffine picture block.

For example, an (M+2)*(N+2) prediction block (namely, the secondprediction matrix) is obtained through interpolation based on a motionvector of an M×N sub-block. Different implementations are providedabove.

Step 2. Calculate a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on the second prediction matrix, wherethe size of the second prediction matrix is greater than or equal tosizes of the horizontal prediction gradient matrix and the verticalprediction gradient matrix.

Step 3. Calculate a delta prediction value (ΔI(i,j)) of the currentsample in the sub-block based on a horizontal prediction gradient valueof the current sample in the sub-block in the horizontal predictiongradient matrix, a vertical prediction gradient value of the currentsample in the vertical prediction gradient matrix, and a differencebetween the motion vector of the current sample of the current sub-blockand the motion vector of the center sample of the sub-block.

Correspondingly, in step S1102, the obtaining a refined predictionsample value (for example, a prediction signal I′(i, j)) of thesub-block based on the delta prediction value (for example, ΔI(i, j)) ofthe sub-block and a prediction sample value (for example, a predictionsignal I(i, j)) of the sub-block may include:

obtaining a refined prediction sample value (for example, a predictionsignal I′(i, j)) of the current sample based on a delta prediction value(for example, ΔI(i, j)) of the current sample in the sub-block and aprediction sample value (for example, a prediction signal I(i, j)) ofthe current sample.

It should be understood that the prediction sample values (for example,the prediction signal I(i, j)) of the sub-block may be an MxN predictionblock in an (M+2)*(N+2) prediction block.

For the step 3, in an implementation, motion vector differences betweenmotion vectors of different samples in the current sub-block and amotion vector of the center sample of the sub-block are different. Inanother implementation, the motion vector difference between a motionvector of a current sample unit (for example, a 2×2 sample block)containing the current sample and the motion vector of the center sampleof the sub-block is used as a motion vector difference between themotion vector of the current sample of the current sub-block and themotion vector of the center sample of the sub-block. In other words, tobalance processing overheads and prediction accuracy, assuming that bothsamples A and B are included in the current sample unit, a motion vectordifference between a motion vector of a current sample unit (forexample, a 2×2 sample block) and a motion vector of a center sample ofthe sub-block may be used as a motion vector difference between themotion vector of the sample A in the sub-block and the motion vector ofthe center sample of the sub-block; Also, a motion vector differencebetween the motion vector of the current sample unit and the motionvector of the center sample of the sub-block may be used as a motionvector difference between the motion vector of the sample B in thesub-block and the motion vector of the center sample of the sub-block.

In an implementation, the second prediction matrix in the above step 1is represented by I₁(p, q), where a value range of p is [−1, sbW], and avalue range of q is [−1, sbH];

the horizontal prediction gradient matrix is represented by X(i, j),where a value range of i is [0, sbW−1], and a value range of j is [0,sbH−1]; and

the vertical prediction gradient matrix is represented by Y(i, j), wherea value range of i is [0, sbW−1], and a value range of j is [0, sbH−1];where

sbW represents a width of the current sub-block in the current affinepicture block, sbH represents a height of the current sub-block in thecurrent affine picture block, and (x, y) represents location coordinatesof each sample (also referred to as a sample) in the current sub-blockin the current affine picture block, and the element located at (x, y)may correspond to the element located at (i, j).

In another possible design, in step 1102, the performing optical flow(prediction refinement with optical flow, PROF) processing for one ormore sub-blocks (for example, each sub-block) in the current affinepicture block, to obtain a delta prediction value (also referred to as apredictor offset value, for example, ΔI(i, j)) of the one or moresub-blocks (for example, each sub-block) in the current affine pictureblock includes, as shown in FIG. 12:

S1202. obtaining or generating a second prediction matrix based on afirst prediction matrix, the first prediction matrix (for example, afirst prediction signal I(i, j) or a 4×4 prediction) of the sub-block(for example, each sub-block) corresponds to prediction sample values ofthe current sub-block. The subblock-based affine motion compensation fora current sub-block of the affine coded block is performed to obtainprediction sample values of the current sub-block of the affine codedblock, as shown in FIG. 9A.

S1203. calculating a horizontal prediction gradient matrix and avertical prediction gradient matrix based on a second prediction matrix,where a size of the second prediction matrix is greater than or equal toa size of the first prediction matrix, and the size of the secondprediction matrix is greater than or equal to sizes of the horizontalprediction gradient matrix and the vertical prediction gradient matrix;and

S1204. calculating a delta prediction value matrix (for example, ΔI(i,j)of a prediction signal) of the sub-block based on the horizontalprediction gradient matrix, the vertical prediction gradient matrix, anda motion vector difference between the motion vector of the currentsample unit (for example, a current sample or a current sample block,such as a 2×2 sample block) of the sub-block and the motion vector ofthe center sample of the sub-block; and

the step of obtaining a refined prediction sample value (for example, aprediction signal I′(i, j)) of the sub-block based on the deltaprediction value (for example, ΔI(i, j)) of the sub-block and aprediction sample value (for example, a prediction signal I(i, j)) ofthe sub-block includes:

S1205. obtaining a refined third prediction matrix (for example, aprediction signal I′(i, j)) of the sub-block based on the deltaprediction value matrix (for example, ΔI(i, j)) and the first predictionmatrix (for example, the prediction signal I(i, j)).

It should be understood that, I(i, j) herein represents a predictionsample value (for example, an original prediction obtained throughmotion compensation) of the current sample in the current sub-block,ΔI(i, j) represents a delta prediction value of the current sample inthe current sub-block, and I′ (i,j) represents a refined predictionsample value of the current sample in the current sub-block. Forexample, the original prediction sample value+the delta predictionvalue=the refined prediction sample value. It should be understood thatobtaining refined prediction sample values of a plurality of samples(for example, all samples) in the current sub-block is equivalent toobtaining refined prediction sample values of the current sub-block.

In different possible implementations, a gradient value may becalculated sample by sample and a delta prediction value may becalculated sample by sample. Alternatively, a gradient value matrix maybe obtained and then a delta prediction value may be calculated. This isnot limited in this application. In an alternative implementation, thefirst prediction matrix and the second prediction matrix represent asame prediction matrix.

For a case in which the size of the second prediction matrix is equal tothe size of the first prediction matrix and the size of the secondprediction matrix is equal to the sizes of the horizontal predictiongradient matrix and the vertical prediction gradient matrix, in apossible implementation, a (w−2)*(h−2) gradient matrix is calculated byusing a w*h prediction matrix, and the gradient matrix is padded toobtain a size of w*h, where w*h represents a size of the currentsub-block. For example, both the first prediction matrix and the secondprediction matrix are prediction matrices whose sizes are w*h or thefirst prediction matrix and the second prediction matrix represent asame prediction matrix.

As shown in FIG. 11B, another embodiment of this application providesanother method for prediction refinement with optical flow (PROF) for anaffine coded block, including the following steps:

S1110. It is determined whether a plurality of optical flow decisionconditions are fulfilled or satisfied or not. Here the optical flowdecision conditions refer to the conditions allowing for the applicationof PROF.

S1111. If the plurality of optical flow decision conditions arefulfilled, a first indicator (for example, applyProfFlag) is set equalto true, and performing a prediction refinement with optical flow(PROF)process for a current sub-block of the affine coded block, to obtainrefined prediction sample values of the current sub-block of the affinecoded block. In step S1111, optical flow (prediction refinement withoptical flow, PROF) processing is performed for one or more sub-blocks(for example, each sub-block) in the current affine picture block, toobtain a delta prediction value (also referred to as a predictor offsetvalue, for example, ΔI(i, j)) of the one or more sub-blocks (forexample, each sub-block) in the current affine picture block.

In step S1111, a refined prediction sample value (for example, aprediction signal I′(i, j)) of the sub-block is obtained based on thedelta prediction value (for example, ΔI(i, j)) and a prediction samplevalue (for example, a prediction signal I(i, j)) of the sub-block.

It should be understood that, I(i, j) herein represents a predictionsample value (for example, an original prediction sample value obtainedthrough motion compensation) of the current sample in the currentsub-block, ΔI(i, j) represents a delta prediction value of the currentsample in the current sub-block, and I′(i,j) represents a refinedprediction sample value of the current sample in the current sub-block.For example, the original prediction sample value+the delta predictionvalue=the refined prediction sample value. It should be understood thatobtaining refined prediction sample values of a plurality of samples(for example, all samples) in the current sub-block is equivalent toobtaining refined prediction sample values of the current sub-block.

It can be understood that when the refined prediction sample values ofeach sub-block of the affine coded block are generated, the refinedprediction sample values of the affine coded block are naturallygenerated. S1113, when the at least one of the plurality of optical flowdecision conditions is not fulfilled or satisfied, a first indicator(for example, applyProfFlag) is set equal to false, and the PROF processis skipped.

It can be understood that if constraint conditions for applying PROF areused to determine whether to apply PROF, the step S1110 will be changedto determining whether none of a plurality of the constraint conditionsfor applying PROF is fulfilled. In this case, the step S1111 will bechanged to: if none of a plurality of the constraint conditions forapplying PROF is fulfilled or satisfied, a first indicator (for example,applyProfFlag) is set equal to true, and performing a predictionrefinement with optical flow (PROF) process for a current sub-block ofthe affine coded block, to obtain refined prediction sample values ofthe current sub-block of the affine coded block. Accordingly, the stepS1113 will be changed to: if at least one of the plurality of theconstraint conditions for applying PROF is fulfilled, the firstindicator (for example, applyProfFlag) is set equal to false, and thePROF process is skipped.

In an implementation, if the first indicator (for example,applyProfFlag) is a first value (for example, 1), performing opticalflow (for example, PROF) processing for the one or more sub-blocks (forexample, each sub-block) in the current affine picture block; or,

Otherwise, if the first indicator (for example, applyProfFlag) is asecond value (for example, 0), skipping performing optical flow (forexample, PROF) processing for the one or more sub-blocks (for example,each sub-block) in the current affine picture block.

In an implementation, a value of the first indicator depends on whetherthe optical flow decision conditions are fulfilled or not, where theoptical flow decision conditions includes one or more of the following:

first indication information (for example, spsprof_enabled_flag orsps_bdof_enabled_flag) is used to indicate that PROF is enabled for acurrent picture unit. It should be noted that the current picture unitherein may be, for example, a current sequence, a current picture, acurrent slice, or a current tile group. These examples of the currentpicture unit are not limiting.

second indication information (for example, fallbackModeTriggered) isused to indicate to partition the current affine picture block;

the current affine picture block is a uni-prediction affine pictureblock;

a size of the sub-block in the affine picture block is greater than N×N,wherein N=4;

the current affine picture block is a uni-prediction affine pictureblock and a size of the sub-block in the affine picture block is equalto N×N, wherein N=4; or the current affine picture block is abi-prediction affine picture block and a size of the sub-block in theaffine picture block is greater than N×N, wherein N=4.

It should be noted that this application includes but is not limited tothe foregoing optical flow decision conditions, and additional ordifferent optical flow decision conditions may be set based on differentapplication scenarios.

In this embodiment of this application, for example, when all thefollowing conditions are met, applyProfFlag is set to 1:

-   -   spsprof_enabled_flag==1    -   fallbackModeTriggered==0    -   interpred_idc[x0][y0]=PRED_L0 or PRED_L1; (or predFlagL0=1,        predFlagL1=0; or predFlagL1=1, predFlagL0=0)    -   Other conditions

In another embodiment, for example, when all the following conditionsare met, applyProfFlag is set to 1:

-   -   sps_prof_enabled_flag−1    -   fallbackModeTriggered==0    -   other conditions

It can be understood that if constraint conditions for applying PROF areused in S1110 instead of the optical flow decision conditions, when noneof all the following constraint conditions are met, applyProfFlag is setto 1:

-   -   sps_prof_disabled_flag==1    -   fallbackModeTriggered==1    -   other conditions

It should be understood that, for details about an execution entity ofthe steps in the prediction method provided in this embodiment of thisapplication and extensions and variations of these steps, refer to theforegoing descriptions of the corresponding methods. For brevity,details are not described in this specification again.

Another embodiment of this application further provides another PROFprocess, including:

obtaining a first prediction matrix of the M*N block based on motioninformation (for example, a motion vector) of a plurality of sub-blocksin a current affine picture block; for example, M*N block is 16*16, asshown in FIG. 9E. for example, the 16*16 block (or the 16*16 window)includes 16 of 4*4 subblocks.

calculating a horizontal prediction gradient matrix and a verticalprediction gradient matrix based on a second prediction matrix, where asize of the second prediction matrix is greater than or equal to a sizeof the first prediction matrix, and the size of the second predictionmatrix is greater than or equal to sizes of the horizontal predictiongradient matrix and the vertical prediction gradient matrix; and

calculating a delta prediction value matrix (for example, ΔI(i, j) of aprediction signal) of the M*N block based on the horizontal predictiongradient matrix, the vertical prediction gradient matrix, and a motionvector difference between a motion vector of the current pixel unit (forexample, a current pixel or a current pixel block, such as a 2×2 pixelblock) in the M*N block and a motion vector of a center pixel of the M*Nblock; and

obtaining a refined third prediction matrix (for example, a predictionsignal I′(i, j)) of the M*N block based on the delta prediction valuematrix (for example, ΔI(i, j)) and the first prediction matrix (forexample, the prediction signal I(i,j)).

In another possible design, the first prediction matrix is representedby I₁(i, j), where a value range of i is [0, size_w−1], and a valuerange of j is [0, size_h−1];

the second predictor matrix is represented by I₂(i, j), where a valuerange of i is [−1, size_w], and a value range of j is [−1, size_h],where size_w=min(W, m), size_h=min(H, m), and m=16;

the horizontal prediction gradient matrix is represented by X(i, j),where a value range of i is [0, size_w−1], and a value range of j is [0,size_h−1]; and

the vertical prediction gradient matrix is represented by Y(i, j), wherea value range of i is [0, size_w−1], and a value range of j is [0,size_h−1]; where

W represents a width of the current affine picture block, H represents aheight of the current affine picture block, and (x, y) representslocation coordinates of each sample in the current affine picture block.

It should be understood that, as shown in FIG. 9E, in some examples, anaffine picture block is implicitly partitioned into 16×16 blocks, and agradient matrix is calculated for each 16×16 block. Correspondingly, thesecond prediction matrix is represented by I₂(i, j), where a value rangeof i is [−1, size_w], and a value range of j is [−1, size_h], wheresize_w=min(w, m), size_h=min(h, m), and m=16. The horizontal predictiongradient matrix is represented by X(i, j), where a value range of i is[0, size_w−1], and a value range of j is [0, size_h−1]. The verticalprediction gradient matrix is represented by Y(i, j), where a valuerange of i is [0, size_w−1], and a value range of j is [0, size_h−1].

In another possible design, the calculating a horizontal predictiongradient matrix and a vertical prediction gradient matrix (for example,size_w*size_h gradient values) based on a second prediction matrix (forexample, a (size_w+2)*(size_h+2) prediction signal) includes:

calculating the horizontal prediction gradient matrix and the verticalprediction gradient matrix based on the second prediction matrix, wherethe horizontal prediction gradient matrix and the vertical predictiongradient matrix include: a horizontal prediction gradient matrix and avertical prediction gradient matrix of the sub-block, respectively,where

the second prediction matrix is represented by I₂(i, j), where a valuerange of i is [−1, size_w], and a value range of j is [−1, size_h],where size_w=min(W, m), size_h=min(H, m), and m=16;

the horizontal prediction gradient matrix is represented by X(i, j),where a value range of i is [0, size_w−1], and a value range of j is [0,size_h−1]; and

the vertical prediction gradient matrix is represented by Y(i, j), wherea value range of i is [0, size_w−1], and a value range of j is [0,size_h−1]; where

W represents a width of the current affine picture block, H represents aheight of the current affine picture block, and (i, j) representslocation coordinates of each sample in the current affine picture block.

It can be learned from the foregoing description that the current affinepicture block is implicitly partitioned into 16×16 blocks, and agradient matrix is calculated for each 16×16 block. It should beunderstood that m=16 is used merely as an example herein and should notbe construed as limiting. Various other values of m can be used, such asm=32.

In a possible design, the method is used for uni-prediction; and themotion information includes first motion information corresponding to afirst reference frame list, or second motion information correspondingto a second reference frame list; and

the first prediction matrix includes (is) a first initial predictionmatrix or a second initial prediction matrix, where the first initialprediction matrix is obtained based on the first motion information, andthe second initial prediction matrix is obtained based on the secondmotion information;

the horizontal prediction gradient matrix includes (is) a firsthorizontal prediction gradient matrix or a second horizontal predictiongradient matrix, where the first horizontal prediction gradient matrixis obtained through calculation based on an extended first initialprediction matrix, and the second horizontal prediction gradient matrixis obtained through calculation based on an extended second initialprediction matrix;

the vertical prediction gradient matrix includes (is) a first verticalprediction gradient matrix or a second vertical prediction gradientmatrix, where the first vertical prediction gradient matrix is obtainedthrough calculation based on an extended first initial predictionmatrix, and the second vertical prediction gradient matrix is obtainedthrough calculation based on an extended second initial predictionmatrix; and

the delta prediction value matrix includes (is) a first delta predictionvalue matrix corresponding to the first reference frame list or a seconddelta prediction value matrix corresponding to the second referenceframe list, where the first delta prediction value matrix is obtainedthrough calculation based on the first horizontal prediction gradientmatrix, the first vertical prediction gradient matrix, and a firstmotion vector difference (for example, a forward motion vectordifference) of each sample unit in the sub-block relative to the centersample of the sub-block, and the second delta prediction value matrix isobtained through calculation based on the second horizontal predictiongradient matrix, the second vertical prediction gradient matrix, and asecond motion vector difference (for example, a backward motion vectordifference) of each sample unit in the sub-block relative to the centersample of the sub-block.

In a possible design, the method is used for bi-prediction, and themotion information includes first motion information corresponding to afirst reference frame list and second motion information correspondingto a second reference frame list; and

the first prediction matrix includes a first initial prediction matrixand a second initial prediction matrix, where the first initialprediction matrix is obtained based on the first motion information, andthe second initial prediction matrix is obtained based on the secondmotion information;

the horizontal prediction gradient matrix includes a first horizontalprediction gradient matrix and a second horizontal prediction gradientmatrix, the first horizontal prediction gradient matrix is obtainedthrough calculation based on an extended first initial predictionmatrix, and the second horizontal prediction gradient matrix is obtainedthrough calculation based on an extended second initial predictionmatrix;

the vertical prediction gradient matrix includes a first verticalprediction gradient matrix and a second vertical prediction gradientmatrix, where the first vertical prediction gradient matrix is obtainedthrough calculation based on an extended first initial predictionmatrix, and the second vertical prediction gradient matrix is obtainedthrough calculation based on an extended second initial predictionmatrix; and

the delta prediction value matrix includes a first delta predictionvalue matrix corresponding to the first reference frame list and asecond delta prediction value matrix corresponding to the secondreference frame list, where the first delta prediction value matrix isobtained through calculation based on the first horizontal predictiongradient matrix, the first vertical prediction gradient matrix, and afirst motion vector difference (for example, a forward motion vectordifference) of each sample unit in the sub-block relative to the centersample of the sub-block, and the second delta prediction value matrix isobtained through calculation based on the second horizontal predictiongradient matrix, the second vertical prediction gradient matrix, and asecond motion vector difference (for example, a backward motion vectordifference) of each sample unit in the sub-block relative to the centersample of the sub-block.

In a possible design, the method is used for uni-prediction;

the motion information includes first motion information correspondingto a first reference frame list or second motion informationcorresponding to a second reference frame list; and

the first prediction matrix includes (is) a first initial predictionmatrix or a second initial prediction matrix, where the first initialprediction matrix is obtained based on the first motion information, andthe second initial prediction matrix is obtained based on the secondmotion information.

In a possible design, the method is used for bi-prediction;

the motion information includes first motion information correspondingto a first reference frame list and second motion informationcorresponding to a second reference frame list; and

the first prediction matrix includes the first initial prediction matrixand the second initial prediction matrix, where the first initialprediction matrix is obtained based on the first motion information, andthe second initial prediction matrix is obtained based on the secondmotion information; and

the obtaining a prediction matrix of the sub-block based on the motioninformation of the sub-block includes:

performing weighted summation on sample values at a same location in thefirst initial prediction matrix and the second initial predictionmatrix, to obtain the prediction matrix of the sub-block. It should beunderstood that, before weighted summation is performed herein, samplevalues in the first initial prediction matrix and the second initialprediction matrix may be separately refined.

In another possible design, the PROF process is described as followingfour steps.

Step 1) The sub-block-based affine motion compensation is performed togenerate sub-block prediction I(i, j). For example, i has a value from[0, subW+1] or [−1, subW], and j has a value from [0, subH+1] or [−1,subH]. It can be understood that the top-left sample (or the origin ofcoordinates) is located at (1, 1) for i has a value from [0, subW+1] andj has a value from [0, subH+1]; while, the top-left sample is located at(0, 0) for i has a value from [−1, subW] and j has a value from [−1,subH].

Step 2) The spatial gradients g_(x)(i,j) and g_(y)(i,j) of the sub-blockprediction are calculated at each sample location using a 3-tap filter[−1, 0, 1].

g _(x)(i,j)=I(i+1,j)−I(i−1,j)

g _(y)(i,j)=I(i,j+1)−I(i,j−1)

The sub-block prediction is extended by one sample on each side for thegradient calculation. To reduce the memory bandwidth and complexity, thesamples on the extended borders are copied from the nearest integersample position in the reference picture. Therefore, additionalinterpolation for padding region is avoided.

Step 3) The luma prediction refinement is calculated by the optical flowequation.

ΔI(i,j)=g _(x)(i,j)*Δv _(x)(i,j)+g _(y)(i,j)*Δv _(y)(i,j)

where the Δv(i, j) is the difference between sample MV computed forsample location (i,j), denoted by v(i,j), and the sub-block MV of thesub-block to which sample (i,j) belongs, as shown in FIG. 10.

In other words, an MV of each 4×4 center sample is calculated, and thenan MV of each sample of the sub-block is calculated. The differenceΔv(i, j) between the MV of each sample and the MV of the center samplecan be obtained.

Since the affine model parameters and the sample location relative tothe sub-block center are not changed from sub-block to sub-block, Δv (i,j) can be calculated for the first sub-block, and reused for othersub-blocks in the same CU. Let x and y be the horizontal and verticaloffset from the sample location to the center of the sub-block, Δv(x, y)can be derived by the following equation,

$\left\{ {\begin{matrix}{{{\Delta v}_{x}\left( {x,y} \right)} = {{c*x} + {d*y}}} \\{{{\Delta v}_{y}\left( {x,y} \right)} = {{e*x} + {f*y}}}\end{matrix}\quad} \right.$

For 4-parameter affine model,

$\left\{ {\begin{matrix}{c = {f = \frac{v_{1x} - v_{0x}}{w}}} \\{e = {{- d} = \frac{v_{1y} - v_{0y}}{w}}}\end{matrix}\quad} \right.$

For 6-parameter affine model,

$\left\{ {\begin{matrix}{c = \frac{v_{1x} - v_{0x}}{w}} \\{d = \frac{v_{2x} - v_{0x}}{h}} \\{e = \frac{v_{1y} - v_{0y}}{w}} \\{f = \frac{v_{2y} - v_{0y}}{h}}\end{matrix}\quad} \right.$

where (v_(0x), v_(0y)), (v_(1x), v_(1y)), (v_(2x), v_(2y)) are thetop-left, top-right and bottom-left control point motion vectors, w andh are the width and height of the CU.

Step 4) Finally, the luma prediction refinement is added to thesub-block prediction I(i,j). The final prediction I′ is generated asshown in the following equation.

I′(i,j)=I(i,j)+ΔI(i,j)

FIG. 15 illustrates an apparatus 1500 for prediction refinement withoptical flow (PROF) for an affine coded block according to anotheraspect of the disclosure. In an example, the apparatus 1500 comprises:

a determining unit 1501 configured for determining that none of theplurality of constraint conditions for applying PROF are fulfilled;

a prediction processing unit 1503 configured for performing a predictionrefinement with optical flow, PROF process for a current sub-block ofthe affine coded block, to obtain refined prediction sample values ofthe current sub-block of the affine coded block. It can be understoodthat when the refined prediction sample values of each sub-block of theaffine coded block are generated, the refined prediction sample valuesof the affine coded block are naturally generated.

In another example, the apparatus 1500 comprises:

a determining unit 1501 configured for determining that a plurality ofoptical flow decision conditions are fulfilled; Here, the plurality ofoptical flow decision conditions refer to the conditions allowing forthe application of PROF.

a prediction processing unit 1503 configured for performing a PROFprocess for a current sub-block of the affine coded block, to obtainrefined prediction sample values of the current sub-block of the affinecoded block. It can be understood that when the refined predictionsample values of each sub-block of the affine coded block are generated,the refined prediction sample values of the affine coded block arenaturally generated.

Correspondingly, in an example, an example structure of the apparatus1500 may be corresponding to encoder 20 in FIG. 2. In another example,an example structure of the apparatus 1500 may be corresponding to thedecoder 30 in FIG. 3.

In another example, an example structure of the apparatus 1500 may becorresponding to the inter prediction unit 244 in FIG. 2. In anotherexample, an example structure of the apparatus 1500 may be correspondingto the inter prediction unit 344 in FIG. 3.

It may be understood that the determining unit and the predictionprocessing unit (corresponding to an inter prediction module) in theencoder 20 or the decoder 30 provided in this embodiment of thisapplication is a functional entity for implementing various executionsteps included in the foregoing corresponding method, that is, has afunctional entity for completely implementing steps in the method inthis application and extensions and variations of these steps. Fordetails, refer to the foregoing descriptions of the correspondingmethod. For brevity, details are not described herein again.

Following is an explanation of the applications of the encoding methodas well as the decoding method as shown in the above-mentionedembodiments, and a system using them.

FIG. 16 is a block diagram showing a content supply system 3100 forrealizing content distribution service. This content supply system 3100includes capture device 3102, terminal device 3106, and optionallyincludes display 3126. The capture device 3102 communicates with theterminal device 3106 over communication link 3104. The communicationlink may include the communication channel 13 described above. Thecommunication link 3104 includes but not limited to WIFI, Ethernet,Cable, wireless (3G/4G/5G), USB, or any kind of combination thereof, orthe like.

The capture device 3102 generates data, and may encode the data by theencoding method as shown in the above embodiments. Alternatively, thecapture device 3102 may distribute the data to a streaming server (notshown in the Figures), and the server encodes the data and transmits theencoded data to the terminal device 3106. The capture device 3102includes but not limited to camera, smart phone or Pad, computer orlaptop, video conference system, PDA, vehicle mounted device, or acombination of any of them, or the like. For example, the capture device3102 may include the source device 12 as described above. When the dataincludes video, the video encoder 20 included in the capture device 3102may actually perform video encoding processing. When the data includesaudio (i.e., voice), an audio encoder included in the capture device3102 may actually perform audio encoding processing. For some practicalscenarios, the capture device 3102 distributes the encoded video andaudio data by multiplexing them together. For other practical scenarios,for example in the video conference system, the encoded audio data andthe encoded video data are not multiplexed. Capture device 3102distributes the encoded audio data and the encoded video data to theterminal device 3106 separately.

In the content supply system 3100, the terminal device 310 receives andreproduces the encoded data. The terminal device 3106 could be a devicewith data receiving and recovering capability, such as smart phone orPad 3108, computer or laptop 3110, network video recorder (NVR)/digitalvideo recorder (DVR) 3112, TV 3114, set top box (STB) 3116, videoconference system 3118, video surveillance system 3120, personal digitalassistant (PDA) 3122, vehicle mounted device 3124, or a combination ofany of them, or the like capable of decoding the above-mentioned encodeddata. For example, the terminal device 3106 may include the destinationdevice 14 as described above. When the encoded data includes video, thevideo decoder 30 included in the terminal device is prioritized toperform video decoding. When the encoded data includes audio, an audiodecoder included in the terminal device is prioritized to perform audiodecoding processing.

For a terminal device with its display, for example, smart phone or Pad3108, computer or laptop 3110, network video recorder (NVR)/digitalvideo recorder (DVR) 3112, TV 3114, personal digital assistant (PDA)3122, or vehicle mounted device 3124, the terminal device can feed thedecoded data to its display. For a terminal device equipped with nodisplay, for example, STB 3116, video conference system 3118, or videosurveillance system 3120, an external display 3126 is contacted thereinto receive and show the decoded data.

When each device in this system performs encoding or decoding, thepicture encoding device or the picture decoding device, as shown in theabove-mentioned embodiments, can be used.

FIG. 17 is a diagram showing a structure of an example of the terminaldevice 3106. After the terminal device 3106 receives stream from thecapture device 3102, the protocol proceeding unit 3202 analyzes thetransmission protocol of the stream. The protocol includes but notlimited to Real Time Streaming Protocol (RTSP), Hyper Text TransferProtocol (HTTP), HTTP Live streaming protocol (HLS), MPEG-DASH,Real-time Transport protocol (RTP), Real

Time Messaging Protocol (RTMP), or any kind of combination thereof, orthe like.

After the protocol proceeding unit 3202 processes the stream, streamfile is generated. The file is outputted to a demultiplexing unit 3204.The demultiplexing unit 3204 can separate the multiplexed data into theencoded audio data and the encoded video data. As described above, forsome practical scenarios, for example in the video conference system,the encoded audio data and the encoded video data are not multiplexed.In this situation, the encoded data is transmitted to video decoder 3206and audio decoder 3208 without through the demultiplexing unit 3204.

Via the demultiplexing processing, video elementary stream (ES), audioES, and optionally subtitle are generated. The video decoder 3206, whichincludes the video decoder 30 as explained in the above mentionedembodiments, decodes the video ES by the decoding method as shown in theabove-mentioned embodiments to generate video frame, and feeds this datato the synchronous unit 3212. The audio decoder 3208, decodes the audioES to generate audio frame, and feeds this data to the synchronous unit3212. Alternatively, the video frame may store in a buffer (not shown inFIG. Y) before feeding it to the synchronous unit 3212. Similarly, theaudio frame may store in a buffer (not shown in FIG. Y) before feedingit to the synchronous unit 3212.

The synchronous unit 3212 synchronizes the video frame and the audioframe, and supplies the video/audio to a video/audio display 3214. Forexample, the synchronous unit 3212 synchronizes the presentation of thevideo and audio information. Information may code in the syntax usingtime stamps concerning the presentation of coded audio and visual dataand time stamps concerning the delivery of the data stream itself.

If subtitle is included in the stream, the subtitle decoder 3210 decodesthe subtitle, and synchronizes it with the video frame and the audioframe, and supplies the video/audio/subtitle to a video/audio/subtitledisplay 3216.

The present disclosure is not limited to the above-mentioned system, andeither the picture encoding device or the picture decoding device in theabove-mentioned embodiments can be incorporated into other system, forexample, a car system.

The mathematical operators used in this application are similar to thoseused in the C programming language. However, the results of integerdivision and arithmetic shift operations are defined more precisely, andadditional operations are defined, such as exponentiation andreal-valued division.

For explanations of related content in this embodiment, implementationsof related steps, beneficial effects, and the like, refer to theforegoing corresponding parts, or simple modifications may be made basedon the foregoing corresponding parts. Details are not described hereinagain.

It should be noted that, in a case in which no conflict occurs, somefeatures in any two or more of the foregoing embodiments may be combinedto form a new embodiment. In addition, some features in any one of theforegoing embodiments may be independently used as an embodiment.

The foregoing mainly describes the solutions provided in the embodimentsof this application from a perspective of the methods. To implement theforegoing functions, corresponding hardware structures and/or softwaremodules for performing the functions are included. A person skilled inthe art should easily be aware that, in combination with the examplesdescribed in the embodiments disclosed in this specification, units andalgorithm steps can be implemented by hardware or a combination ofhardware and computer software in this application. Whether a functionis performed by hardware or hardware driven by computer software dependson particular applications and design constraints of the technicalsolutions. A person skilled in the art may use different methods toimplement the described functions for each particular application, butit should not be considered that the implementation goes beyond thescope of this application.

Division of an encoder/a decoder into functional modules in theembodiments of this application may be performed based on the foregoingmethod examples. For example, each functional module may be obtainedthrough division in correspondence to each function, or at least twofunctions may be integrated into one processing module. The integratedmodule may be implemented in a form of hardware, or may be implementedin a form of a software functional module. It should be noted that, inthe embodiments of this application, module division is an example, andis merely a logical function division. In actual implementation, anotherdivision manner may be used.

Although embodiments of the disclosure have been primarily describedbased on video coding, it should be noted that embodiments of the codingsystem 10, encoder 20 and decoder 30 (and correspondingly the system 10)and the other embodiments described herein may also be configured forstill picture processing or coding, i.e. the processing or coding of anindividual picture independent of any preceding or consecutive pictureas in video coding. In general only inter-prediction units 244 (encoder)and 344 (decoder) may not be available in case the picture processingcoding is limited to a single picture 17. All other functionalities(also referred to as tools or technologies) of the video encoder 20 andvideo decoder 30 may equally be used for still picture processing, e.g.residual calculation 204/304, transform 206, quantization 208, inversequantization 210/310, (inverse) transform 212/312, partitioning 262/362,intra-prediction 254/354, and/or loop filtering 220, 320, and entropycoding 270 and entropy decoding 304.

Embodiments, e.g. of the encoder 20 and the decoder 30, and functionsdescribed herein, e.g. with reference to the encoder 20 and the decoder30, may be implemented in hardware, software, firmware, or anycombination thereof. If implemented in software, the functions may bestored on a computer-readable medium or transmitted over communicationmedia as one or more instructions or code and executed by ahardware-based processing unit. Computer-readable media may includecomputer-readable storage media, which corresponds to a tangible mediumsuch as data storage media, or communication media including any mediumthat facilitates transfer of a computer program from one place toanother, e.g., according to a communication protocol. In this manner,computer-readable media generally may correspond to (1) tangiblecomputer-readable storage media which is non-transitory or (2) acommunication medium such as a signal or carrier wave. Data storagemedia may be any available media that can be accessed by one or morecomputers or one or more processors to retrieve instructions, codeand/or data structures for implementation of the techniques described inthis disclosure. A computer program product may include acomputer-readable medium.

By way of example, and not limiting, such computer-readable storagemedia can comprise RAM, ROM, EEPROM, CD-ROM or other optical diskstorage, magnetic disk storage, or other magnetic storage devices, flashmemory, or any other medium that can be used to store desired programcode in the form of instructions or data structures and that can beaccessed by a computer. Also, any connection is properly termed acomputer-readable medium. For example, if instructions are transmittedfrom a website, server, or other remote source using a coaxial cable,fiber optic cable, twisted pair, digital subscriber line (DSL), orwireless technologies such as infrared, radio, and microwave, then thecoaxial cable, fiber optic cable, twisted pair, DSL, or wirelesstechnologies such as infrared, radio, and microwave are included in thedefinition of medium. It should be understood, however, thatcomputer-readable storage media and data storage media do not includeconnections, carrier waves, signals, or other transitory media, but areinstead directed to non-transitory, tangible storage media. Disk anddisc, as used herein, includes compact disc (CD), laser disc, opticaldisc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wheredisks usually reproduce data magnetically, while discs reproduce dataoptically with lasers. Combinations of the above should also be includedwithin the scope of computer-readable media.

Instructions may be executed by one or more processors, such as one ormore digital signal processors (DSPs), general purpose microprocessors,application specific integrated circuits (ASICs), field programmablelogic arrays (FPGAs), or other equivalent integrated or discrete logiccircuitry. Accordingly, the term “processor,” as used herein may referto any of the foregoing structure or any other structure suitable forimplementation of the techniques described herein. In addition, in someaspects, the functionality described herein may be provided withindedicated hardware and/or software modules configured for encoding anddecoding, or incorporated in a combined codec. Also, the techniquescould be fully implemented in one or more circuits or logic elements.

The techniques of this disclosure may be implemented in a wide varietyof devices or apparatuses, including a wireless handset, an integratedcircuit (IC) or a set of ICs (e.g., a chip set). Various components,modules, or units are described in this disclosure to emphasizefunctional aspects of devices configured to perform the disclosedtechniques, but do not necessarily require realization by differenthardware units. Rather, as described above, various units may becombined in a codec hardware unit or provided by a collection ofinteroperative hardware units, including one or more processors asdescribed above, in conjunction with suitable software and/or firmware.

What is claimed is: 1-34. (canceled)
 35. A method for performing aprediction refinement with optical flow (PROF) process for a currentsub-block of an affine coded block implemented by a coding device,comprising: when a plurality of constraint conditions for applying PROFare not fulfilled for the affine coded block, performing the PROFprocess for the current sub-block of the affine coded block to obtainrefined prediction sample values of the current sub-block of the affinecoded block by performing an optical flow processing for the currentsub-block of the affine coded block to obtain a delta prediction valueof a current sample of the current sub-block; and obtaining a refinedprediction sample value of the current sample based on the deltaprediction value of the current sample and a prediction sample value ofthe current sample of the current sub-block.
 36. The method according toclaim 35, further comprising: before the performing the PROF process forthe current sub-block of the affine coded block, determining that theplurality of constraint conditions for performing the PROF process arenot fulfilled for the affine coded block.
 37. The method according toclaim 35, wherein the plurality of constraint conditions for applyingPROF comprises: first indication information indicating that PROF isdisabled for a picture containing the affine coded block or indicatingthat the PROF is disabled for slices associated with a picturecontaining the affine coded block; and second indication informationindicating no partition of the affine coded block.
 38. The methodaccording to claim 35, wherein one of the plurality of constraintconditions for applying PROF is that a variable fallbackModeTriggered isset to
 1. 39. The method according to claim 35, wherein the performingthe optical flow processing for the current sub-block to obtain thedelta prediction value of the current sample of the current sub-blockcomprises: obtaining a second prediction matrix, wherein the secondprediction matrix is generated based on motion information of thecurrent sub-block; generating a horizontal prediction gradient matrixand a vertical prediction gradient matrix based on the second predictionmatrix, wherein the horizontal prediction gradient matrix and thevertical prediction gradient matrix have a same size and a size of thesecond prediction matrix is greater than or equal to the size of thehorizontal prediction gradient matrix and the vertical predictiongradient matrix; and calculating the delta prediction value of thecurrent sample of the current sub-block based on a horizontal predictiongradient value of the current sample in the horizontal predictiongradient matrix, a vertical prediction gradient value of the currentsample in the vertical prediction gradient matrix, and a differencebetween a motion vector of the current sample of the current sub-blockand a motion vector of a center sample of the sub-block.
 40. The methodaccording to claim 39, wherein the obtaining the second predictionmatrix comprises: generating a first prediction matrix based on motioninformation of the current sub-block, wherein elements of the firstprediction matrix correspond to prediction sample values of the currentsub-block, and generating the second prediction matrix based on thefirst prediction matrix;.
 41. The method according to claim 39, whereinan element of the second prediction matrix is represented by I₁(p, q),wherein a value range of p is [−1, sbW], and a value range of q is [−1,sbH], an element of the horizontal prediction gradient matrix isrepresented by X(i, j) and corresponds to sample (i,j) of the currentsub-block in the affine coded block, wherein a value range of i is [0,sbW−1], and a value range of j is [0, sbH−1], an element of the verticalprediction gradient matrix is represented by Y(i, j) and corresponds tosample (i,j) of the current sub-block in the affine coded block, whereina value range of i is [0, sbW−1], and a value range of j is [0, sbH−1],and wherein sbW represents a width of the current sub-block in theaffine coded block, and sbH represents a height of the current sub-blockin the affine coded block.
 42. The method according to claim 35, furthercomprising: before the performing the PROF process for the currentsub-block of the affine coded block, performing subblock-based affinemotion compensation for the current sub-block of the affine coded blockto obtain prediction sample values of the current sub-block.
 43. Amethod for performing a prediction refinement with optical flow (PROF)process for a current sub-block of an affine coded block implemented bya coding device, comprising: when a plurality of optical flow decisionconditions are fulfilled for the affine coded block, performing the PROFprocess for the current sub-block of the affine coded block to obtainrefined prediction sample values of the current sub-block of the affinecoded block by performing an optical flow processing for the currentsub-block of the affine coded block to obtain a delta prediction valueof a current sample of the current sub-block; and obtaining a refinedprediction sample value of the current sample based on the deltaprediction value of the current sample and a prediction sample value ofthe current sample of the current sub-block.
 44. The method according toclaim 43, further comprising: before the performing the PROF process forthe current sub-block of the affine coded block, determining that theplurality of optical flow decision conditions are fulfilled for theaffine coded block.
 45. The method according to claim 43, wherein theplurality of second optical flow decision conditions comprises: firstindication information indicating that PROF is enabled for a picturecontaining the affine coded block or indicating that PROF is enabled forslices associated with a picture containing the affine coded block; andsecond indication information indicating partition is applied to theaffine coded block.
 46. The method according to claim 43, wherein one ofthe plurality of the second optical flow decision conditions is that avariable fallbackModeTriggered is set to
 0. 47. The method according toclaim 43, wherein the performing the optical flow processing for thecurrent sub-block to obtain the delta prediction value of the currentsample of the current sub-block comprises: obtaining a second predictionmatrix, wherein the second prediction matrix is generated based onmotion information of the current sub-block; generating a horizontalprediction gradient matrix and a vertical prediction gradient matrixbased on the second prediction matrix, wherein the horizontal predictiongradient matrix and the vertical prediction gradient matrix have a samesize and a size of the second prediction matrix is greater than or equalto the size of the horizontal prediction gradient matrix and thevertical prediction gradient matrix; and calculating the deltaprediction value of the current sample of the current sub-block based ona horizontal prediction gradient value of the current sample in thehorizontal prediction gradient matrix, a vertical prediction gradientvalue of the current sample in the vertical prediction gradient matrix,and a difference between a motion vector of the current sample of thecurrent sub-block and a motion vector of a center sample of thesub-block.
 48. The method according to claim 47, wherein the obtainingthe second prediction matrix, comprises: generating a first predictionmatrix based on motion information of the current sub-block, whereinelements of the first prediction matrix correspond to prediction samplevalues of the current sub-block, and generating the second predictionmatrix based on the first prediction matrix.
 49. The method according toclaim 47, wherein an element of the second prediction matrix isrepresented by I₁(p, q), wherein a value range of p is [−1, sbW], and avalue range of q is [−1, sbH], an element of the horizontal predictiongradient matrix is represented by X(i, j) and corresponds to sample(i,j) of the current sub-block in the affine coded block, wherein avalue range of i is [0, sbW−1], and a value range of j is [0, sbH−1], anelement of the vertical prediction gradient matrix is represented byY(i, j) and corresponds to sample (i,j) of the current sub-block in theaffine coded block, wherein a value range of i is [0, sbW−1], and avalue range of j is [0, sbH−1], and wherein sbW represents a width ofthe current sub-block in the affine coded block, and sbH represents aheight of the current sub-block in the affine coded block.
 50. Themethod according to claim 43, further comprising: before the performingthe PROF process for the current sub-block of the affine coded block,performing subblock-based affine motion compensation for the currentsub-block of the affine coded block to obtain prediction sample valuesof the current sub-block.
 51. An apparatus for performing a predictionrefinement with optical flow (PROF) process for a current sub-block ofan affine coded block, comprising: one or more electronic circuits orprocessors configured to: perform, when a plurality of constraintconditions for applying PROF are not fulfilled for the affine codedblock, the PROF process for the current sub-block of the affine codedblock to obtain refined prediction sample values of the currentsub-block of the affine coded block by performing an optical flowprocessing for the current sub-block of the affine coded block to obtaina delta prediction value of a current sample of the current sub-block;and obtaining a refined prediction sample value of the current samplebased on the delta prediction value of the current sample and aprediction sample value of the current sample of the current sub-block.52. The apparatus according to claim 51, wherein the one or moreelectronic circuits or processors are further configured to determinethat the plurality of constraint conditions for applying PROF are notfulfilled for the affine coded block.
 53. The apparatus according toclaim 51, wherein the plurality of constraint conditions for applyingPROF comprises: first indication information indicating that PROF isdisabled for a picture containing the affine coded block or indicatingthat the PROF is disabled for slices associated with a picturecontaining the affine coded block; and second indication informationindicating no partition of the affine coded block.
 54. The apparatusaccording to claim 51, wherein one of the plurality of first constraintconditions for applying PROF is that a variable fallbackModeTriggered isset to
 1. 55. The apparatus according to claim 51, wherein the one ormore electronic circuits or processors are further configured to: obtaina second prediction matrix, wherein the second prediction matrix isgenerated based on motion information of the current sub-block; generatea horizontal prediction gradient matrix and a vertical predictiongradient matrix based on the second prediction matrix, wherein thehorizontal prediction gradient matrix and the vertical predictiongradient matrix have a same size and a size of the second predictionmatrix is greater than or equal to the size of the horizontal predictiongradient matrix and the vertical prediction gradient matrix; andcalculate the delta prediction value of the current sample of thecurrent sub-block based on a horizontal prediction gradient value of thecurrent sample in the horizontal prediction gradient matrix, a verticalprediction gradient value of the current sample in the verticalprediction gradient matrix, and a difference between a motion vector ofthe current sample of the current sub-block and a motion vector of acenter sample of the current sub-block.
 56. The apparatus according toclaim 55, wherein the one or more electronic circuits or processors arefurther configured to: generate a first prediction matrix based onmotion information of the current sub-block, wherein elements of thefirst prediction matrix correspond to prediction sample values of thecurrent sub-block, and generating the second prediction matrix based onthe first prediction matrix; or generate the second prediction matrixbased on the motion information of the current sub-block.
 57. Theapparatus according to claim 55, wherein an element of the secondprediction matrix is represented by I₁(p, q), wherein a value range of pis [−1, sbW], and a value range of q is [−1, sbH], an element of thehorizontal prediction gradient matrix is represented by X(i, j) andcorresponds to sample (i,j) of the current sub-block in the affine codedblock, wherein a value range of i is [0, sbW−1], and a value range of jis [0, sbH−1], an element of the vertical prediction gradient matrix isrepresented by Y(i, j) and corresponds to sample (i,j) of the currentsub-block in the affine coded block, wherein a value range of i is [0,sbW−1], and a value range of j is [0, sbH−1], and wherein sbW representsa width of the current sub-block in the affine coded block, and sbHrepresents a height of the current sub-block in the affine coded block.58. The apparatus according to claim 51, wherein the one or moreelectronic circuits or processors are further configured to: performsubblock-based affine motion compensation for the current sub-block ofthe affine coded block to obtain prediction sample values of the currentsub-block.
 59. An apparatus for performing a prediction refinement withoptical flow (PROF) process for a current sub-block of an affine codedblock, comprising: one or more electronic circuits or processorsconfigured to: perform, when a plurality of optical flow decisionconditions are fulfilled for the affine coded block, the PROF processfor the current sub-block of the affine coded block to obtain refinedprediction sample values of the current sub-block of the affine codedblock by perform an optical flow processing for the current sub-block ofthe affine coded block to obtain a delta prediction value of a currentsample of the current sub-block; and obtain a refined prediction samplevalue of the current sample based on the delta prediction value of thecurrent sample and a prediction sample value of the current sample ofthe current sub-block.
 60. The apparatus according to claim 59, whereinthe one or more electronic circuits or processors are further configuredto: determine that the plurality of optical flow decision conditions arefulfilled for the affine coded block.
 61. The apparatus according toclaim 59, wherein the plurality of second optical flow decisionconditions comprises: first indication information indicating that PROFis enabled for a picture containing the affine coded block or indicatingthat PROF is enabled for slices associated with a picture containing theaffine coded block; and second indication information indicatingpartition is applied to the affine coded block.
 62. The apparatusaccording to claim 59, wherein one of the plurality of the secondoptical flow decision conditions is that a variablefallbackModeTriggered is set to
 0. 63. The apparatus according to claim59, wherein the one or more electronic circuits or processors arefurther configured to obtain a second prediction matrix, wherein thesecond prediction matrix is generated based on motion information of thecurrent sub-block; generate a horizontal prediction gradient matrix anda vertical prediction gradient matrix based on the second predictionmatrix, wherein the horizontal prediction gradient matrix and thevertical prediction gradient matrix have a same size and a size of thesecond prediction matrix is greater than or equal to the size of thehorizontal prediction gradient matrix and the vertical predictiongradient matrix; and calculate the delta prediction value of the currentsample of the current sub-block based on a horizontal predictiongradient value of the current sample in the horizontal predictiongradient matrix, a vertical prediction gradient value of the currentsample in the vertical prediction gradient matrix, and a differencebetween a motion vector of the current sample of the current sub-blockand a motion vector of a center sample of the sub-block.
 64. Theapparatus according to claim 63, wherein the one or more electroniccircuits or processors are further configured to: generate a firstprediction matrix based on motion information of the current sub-block,wherein elements of the first prediction matrix correspond to predictionsample values of the current sub-block, and generating the secondprediction matrix based on the first prediction matrix.
 65. Theapparatus according to claim 63, wherein an element of the secondprediction matrix is represented by I₁(p, q), wherein a value range of pis [−1, sbW], and a value range of q is [−1, sbH], an element of thehorizontal prediction gradient matrix is represented by X(i, j) andcorresponds to sample (i,j) of the current sub-block in the affine codedblock, wherein a value range of i is [0, sbW−1], and a value range of jis [0, sbH−1], an element of the vertical prediction gradient matrix isrepresented by Y(i, j) and corresponds to sample (i,j) of the currentsub-block in the affine coded block, wherein a value range of i is [0,sbW−1], and a value range of j is [0, sbH−1], and wherein sbW representsa width of the current sub-block in the affine coded block, and sbHrepresents a height of the current sub-block in the affine coded block.66. The apparatus according to claim 59, wherein the one or moreelectronic circuits or processors are further configured to: performsubblock-based affine motion compensation for the current sub-block ofthe affine coded block to obtain prediction sample values of the currentsub-block.
 67. A non-transitory computer-readable media storing computerinstructions for performing a prediction refinement with optical flow(PROF) process for a current sub-block of an affine coded block, thatwhen executed by one or more processors, cause the one or moreprocessors to perform the operations of: when a plurality of constraintconditions for applying PROF are not fulfilled for the affine codedblock, performing the PROF process for the current sub-block of theaffine coded block to obtain refined prediction sample values of thecurrent sub-block of the affine coded block by performing an opticalflow processing for the current sub-block of the affine coded block toobtain a delta prediction value of a current sample of the currentsub-block; and obtaining a refined prediction sample value of thecurrent sample based on the delta prediction value of the current sampleand a prediction sample value of the current sample of the currentsub-block.
 68. A non-transitory computer-readable media storing computerinstructions for performing a prediction refinement with optical flow(PROF) process for a current sub-block of an affine coded block, thatwhen executed by one or more processors, cause the one or moreprocessors to perform the operations of: when a plurality of opticalflow decision conditions are fulfilled for the affine coded block,performing the PROF process for the current sub-block of the affinecoded block to obtain refined prediction sample values of the currentsub-block of the affine coded block by performing an optical flowprocessing for the current sub-block of the affine coded block to obtaina delta prediction value of a current sample of the current sub-block;and obtaining a refined prediction sample value of the current samplebased on the delta prediction value of the current sample and aprediction sample value of the current sample of the current sub-block.